Download

[4.5 -> 4.6] Blackboard component initialization issues

Hi guys, I’m finally back on my UE4 project after getting other work out of the way, and I’ve started to migrate my projects to 4.6/4.7 to take advantage of some new features. I’ve run into a bit of an issue moving from 4.5 to 4.6 though. I’m creating a new UBehaviorTree in my enemy character class:


UPROPERTY(EditAnywhere, Category = Behavior)
class UBehaviorTree* GuardBehaviour;

When I want to initialize the blackboard asset, I’m trying to do it as before in 4.5. My problem is that this function has changed since 4.5 and now accepts a reference to a blackboard data instance:



Super::Possess(pawn);
AGuardBot* Guard = Cast<AGuardBot>(pawn);
	
if (Guard && Guard->GuardBehaviour)
{
		
	BoardComp->InitializeBlackboard(Guard->GuardBehaviour->BlackboardAsset);
        //Rest of possess code
}

I’ve tried dereferencing it, removing the pointer and looking for alternative functions, but I’m having a bit of a mind blank at the moment. Could someone help me out with how to convert my UBehaviorTree pointer to a reference so that the function accepts it properly?

Hi,
Yes, you now need reference, not pointer.

*Guard->GuardBehaviour