I have a property in c++ that should hold the behavior tree to use like this:
UPROPERTY(EditDefaultsOnly, Category = "MyAIController")
I inherit the class from a blueprint and assign the
BTAsset property a behavior tree from the editor. However when I run the code it’s null even though it should be assigned. Any ideas what may be causing this issue? Why is
BTAsset null even though it looks like it’s assigned in the editor property. The behavior tree seems to work if I run it directly from blueprint.
If it looks like assigned the it’s assigned The problem might be the “when” of your code. Properties like that are being set after class’ constructor runs, so if you need to use properties’ values you need to wait at least for
Let me know if that was the case.
I forgot to mention that I use the asset in BeginPlay like this:
I checked the value after
PostLoad but it’s still null.
I’ve just tried it using 4.8 prev 1 build and was not able to repro what you’re experiencing. And I know we’re using this setup in most of our projects so if it didn’t work we’d know.
Would you mind posting a striped-down version of your project so that I can investigate your setup?
Seems to be something specific to my project. Couldn’t reproduce this myself in another project were it worked perfectly. I will have to investigate this issue further. Is probably on my end then.
Thanks for the help!