SelfActor Not Getting Set

I was following a tutorial series to learn the basics of behavior trees ( Ue4 C++ AI Behavior Essentials Part 2 - Smart Objects - YouTube ) and am up to the end of the second episode, having translated their work to fit in my project, with the only major difference being that I am using a custom Pawn subclass called Target instead of a Character subclass. I have rewatched the video multiple times to make sure I have understood their implementation of “Smart Objects” and copied their code as closely as possible, including some steps they left out entirely (cough setting up a nav mesh cough cough), but no matter what I do, the Target I have set up to move along a circular path just refuses to do so. When simulating, the custom SmartObject subtree is getting run, but after setting up the next location for MoveTo to fire on, it just instantly returns to the wait step. From some preliminary digging I’m under the impression that the SelfActor Blackboard key never getting set is why this is the case, but I’m unsure what to do about that. The Target’s code is functioning for the most part if it’s triggering the sub-tree at all, but why does the tree not know what actor it’s working on when it gets in there?

There’s a lot of parts to this so I apologize that I’m unable to whittle down potential fail points to any singular block of code, but I’ll do my best to tl;dr the main pieces of the puzzle.

TargetAIController.h
TargetAIController.cpp
AI Controller to be attached to Target objects via their Blueprint, this sets the dynamic subtree if a Target has one.

SmartObject.h
SmartObject.cpp
The base class for Smart Objects that should be derived and used to implement behavior sub-trees with.

PointPath.h
PointPath.cpp
Smart Object subclass that holds a spline and sets an array of 3D vectors on construction.

BTTask_GetPathPoints.h
BTTask_GetPathPoints.cpp
Custom behavior tree task that feeds a spline point value given by a PointPath to a BlackBoard vector variable to be used by MoveTo.

Target.h
The Pawn subclass that the AI Controller and Smart Object can be attached to.


And here’s the trees in the editor view. As you can see, in both the Target’s default tree (left) and the point traversal tree (right), SelfActor is not set, however the MoveToPoint vector is, based on the spline that is in that open space (and has a nav mesh under it).

Do I need to do something to my Targets to make them BT compatible? I tried adding a movement component but that didn’t work either…

As it turns out, a former question about the MoveTo not working with pawns had the answer nestled within it all along: Behavior Tree MoveTo not working - #10 by perryMUFC92

Specifically, my Target class needed a custom PawnMovementComponent that reimplemented the RequestDirectMove function that MoveTo relies on to do its work (the answer from perry says the class needs to be a NavMovementComponent, but PawnMovementComponent works fine for me as long as that function is implemented). I stumbled upon NavMovementComponent with Pawn in UE4 - Won Bin -John- Kang that gave a pretty good base for how to set up the component, and then I just applied it in Target.cpp like so…

	TargetMovement = CreateDefaultSubobject<UTargetNavMovement(TEXT("Movement"));
	TargetMovement->UpdatedComponent = RootComponent;

and then just had to set the damping to 0 and the box is moving point to point as expected! SelfActor is still set to None, but I guess that wasn’t really the problem here.