AIController->GetBlackboardComponent()->SetValue(...);

Can someone please tell me, how I am supposed to use the function

FVector Location;
AIController->GetBlackboardComponent()->SetValue(FBlackboard::FKey(0), Location);

if not like that? I keep getting an error about no overload matching the parameter types, but they are exactly what they should be. I don’t want to use the name-based versions, because I don’t want to run a string-container-comparison every time I set a value. I rather use an enum that I manually sync with the blackboard entries in the editor, which leaves me with only this function.

First get the keyID that you want to set.

uint8 keyid = AIController->GetBlackboardComponent()->GetKeyID(FName(KeyName));

Next you want to set that key to the value you want to set it. Do not forget to specify the type of the value.

AIController->GetBlackboardComponent()->SetValue<UBlackboardKeyType_Vector>(keyid, Location);

That should do the trick. Tell me if it doesn’t work

Happy coding!

But then I have to do a search/comparison anyway. I can store the keys in some variables, but that makes everything more chaotic again. I found another solution:

*(FVector*)GetBlackboardComponent()->GetKeyRawData((uint8)EBDK::EBDK_ViewDirection) = Direction;
*(AActor**)GetBlackboardComponent()->GetKeyRawData((uint8)EBDK::EBDK_FollowTarget) = Target;

Those work and don’t produce any compiler errors. The “Key” is nothing fancy, just a uint8, so I don’t think it was responsible for the type-error. Thanks anyway.

Actually, for some reason I don’t even want to know, my solution works with vectors, but not with objects (stay NULL). But your “UBlackboardKeyType” made the difference (with or without string search…), so thanks again!