Hallo! I’m in mystery land and hope somebody could shed light on what’s happening.
I have a custom Behavior Tree Task (code below) that I use to find a “random reachable point in radius”. The result is then fed to a standard MoveTo task. Everything works beautifully in PIE and even when I launch my maps as “Standalone Game”. However, if I package the game,
Keeping on fiddling and searching, and I’ve found a post from 2017 reporting a similar problem. Following @rogeriooo lead, I’ve tried to switch my Radius value, as it was fetched from the blackboard:
…aaaaand eventually I managed to get to the root of the problem and solve it. The actual problem: in the packaged game the Blackboard key MaxRoamingDistance was not being set.
In the game I’m making that’s a variable that’s dependent on the level you’re currently in. So it made sense to me to have that variable belong to the LevelScriptActor and have the LevelScriptActor itself write it to that Blackboard. However! Looks like in a packaged game that Blackboard doesn’t exist yet when my LevelScriptActor tries to write to it. And it makes sense: first the LevelScriptActor is spawned; then the character running the Behavior Tree we’re considering; and I believe the Blackboard starts existing in memory only after that character has been possessed by the AI controller that actually ends up running the Behavior Tree.
The solution was to have that Blackboard value written by the AI controller once the character was possessed – pulling it from the LevelScriptActor rather than vice-versa.
And generally speaking, that’s always a good principle when programming in Unreal C++: when it comes to data, always pull, never push!