How to fix code deprecation?

Hi All!Can you help me?

…\Private\EnemyAIController.cpp(196): warning C4996: ‘UBlackboardComponent::SetValueAsObject’: This function is deprecated. Please use SetValue() instead. Please update your code to the new API before upgrading to the next release, otherwise your project will no longer compile.

…\Private\EnemyAIController.cpp(342): warning C4996: ‘UBlackboardComponent::GetValueAsObject’: This function is deprecated. Please use GetValue() instead. Please update your code to the new API before upgrading to the next release, otherwise your project will no longer compile.

Well warning tells you what to do

I know I was trying to fix it. does not work

its my code
BlackboardComp->SetValueAsObject(EnemyKeyID, InPawn);
BlackboardComp->SetValueAsVector(EnemyLocationID, InPawn->GetActorLocation());
BlackboardComp->SetValueAsBool(CanAttackID, Bot->bIsCanAttack);

4.6 works.On 4.7 should be changed

Hey Char1zART-

You should be able to simply remove the “AsObject” from your function calls. The values passed in and returned are of the same type as previous so you should get the same result as you did before. What exactly do you mean by it does not work?

Looking at the BlackboardComponent.h file, the call you would want to make would be SetValue(KeyID, “ObjectValue”). The pieces inside the quotes would change depending on the datatype being used (_Vector && VectorValue / _Bool && BoolValue / etc.)

Below I’ve copied how the SetValue is called inside the UBlackboardComponent.cpp file:

SetValue<UBlackboardKeyType_Object>(KeyID, ObjectValue);

I can not understand what you mean, I can see an example?

Oh! Thank you

I still can not figure out to me that something is wrong
BlackboardComp->SetValueAsObject(EnemyKeyID, InPawn); code do

BlackboardComp->SetValue<UBlackboardValueAsObject>(EnemyKeyID, InPawn);  code after 

its not work

Inside the brackets you want to have UBlackboardKeyType_Object. If you are trying to use a type other than Object, then you would change what is after underscore (_) to the appropriate type (such as Vector or Bool).

if I use
SetValue(EnemyLocationID, InPawn->GetActorLocation());
‘SetValue’ : undeclared identifier
‘UBlackboardKeyType_Vector’ : undeclared identifier

Perhaps I did something wrong?

You need to also

#include "BehaviorTree/Blackboard/BlackboardKeyType_Vector.h"