I’ve been learning how to use Behavior trees recently. I’ve done the tutorials on UE’s website but I’m running into some issues when I try to expand upon it. Basicly, I have a Behavior tree with a blackboard. On each cycle, i want to get a variable of type BasicAICharacter (inherit from character) to update my blackboard. I’m doing so with a service (see screenshot).
The object the behavior tree is run from is itself a BasicAICharacter. However, I cannot just cast the owner Actor into a BasicAICharacter. It seems I also cannot have a variabler of type BasicAICharacter in my blackboard.
check if the character who is running this behavior is from BasicAICharacter, i’m pretty sure you can cast it correctly to the class if the behavior belong to that character.
The Owner Actor you get as part of Execute Receive Tick call is the AI controller of your character, so you first need to cast it to AIController, then call Get Controlled Pawn and cast it to your BaseAICharacter.
To reduce number of casts needed I’ve introduced alternative, AI-centric events to BT nodes so that you’ll get AIController and Pawn right off the bat. This will be available in 4.7 and is already available in github promoted build.