This is a bit of a weird one, but StateTrees don’t appear to honor the same rules that access to variables usually have, which makes it very awkward to work with.
For example, if you have an AI controller and you wanted to bind with an actor in it.
If the variable is public, you can bind to it:
public:
UPROPERTY(VisibleAnywhere, BlueprintReadOnly)
AActor* TargetActor;
But if it’s protected, it’s not bindable, even though you’d expect it to be given it would be accessible in blueprints:
protected:
UPROPERTY(VisibleAnywhere, BlueprintReadOnly)
AActor* TargetActor;
You also can’t bind to functions, so the following also will not work:
public:
UFUNCTION(BlueprintCallable)
AActor* GetTargetActor();
I’m specifically talking about binding as shown below. In the cases where it doesn’t work, TargetActor just is not there.
It happens in 5.5 as well as ue5-main currently.
Overall this means binding is super awkward as it means everything has to be a plain public variable, which obviously isn’t good for encapsulation.
Anyone have any idea what is going on here, it seems odd that the behavior is different for a StateTree vs literally anything else?