UBTFunctionLibrary::ClearBlackboardValue does nothing in 4.6.x

Subj, because UBlackboardComponent::ClearValue uses GetDefault˂UBlackboardKeyType˃() which has ValueSize == 0.

diff --git a/Engine/Source/Runtime/AIModule/Private/BehaviorTree/BlackboardComponent.cpp b/Engine/Source/Runtime/AIModule/Private/BehaviorTree/BlackboardComponent.cpp
index 4081b64…363cc5c 100644
— a/Engine/Source/Runtime/AIModule/Private/BehaviorTree/BlackboardComponent.cpp
+++ b/Engine/Source/Runtime/AIModule/Private/BehaviorTree/BlackboardComponent.cpp
@@ -831,8 +831,8 @@ void UBlackboardComponent::ClearValue(FBlackboard::FKey KeyID)
TSubclassOf ValueType = GetKeyType(KeyID);
if (ValueType)
{
- // c-cast is ok here since ValueType is of at least UBlackboardKeyType and it’s default object has to be UBlackboardKeyType instance
- const bool bChanged = GetDefault()->Clear(RawData);
+ const UBlackboardKeyType* ValueTypeInstance = GetDefault(*ValueType);
+ const bool bChanged = ValueTypeInstance->Clear(RawData);
if (bChanged)
{
NotifyObservers(KeyID);

Hi Slonopotamus,

Sorry for the delay in responding to this post. We recently had some code changes submitted that appeared to address the issue that you described. I checked with the developer who submitted the changes, and he believes the changes do correct this issue. You can see the changes in this commit.

Please let us know if this does not fully address the issue for you.

That commit does fix the issue, but it (commit) isn’t present in 4.6.x.

Yes, that is correct. We have this fix implemented internally, and it will be included in a future released version of the Engine. I don’t believe it will make it into 4.7, though.