I’m trying to use a behavior tree with a string variable. In the CharacterController I’m setting default values for various items on the blackboard. However, the changes I make to these default values only take effect the second time I simulate after saving the changes.
Launch with Default value ‘a’ and Blackboard Value:
Sometimes, after waiting for a while before launching, the values will be set to ‘n/a’ regardless of my default initial value and how many times it was launched. Is there any reason this would be happening? I don’t change the value of the string anywhere besides in that CharacterController which only occurs on Event On Possess.
Where are you setting the values in your controller, i.e. Begin Play, Tick?? This is important on where you do it because of the way everything loads when the game starts. The Player initiates before the Player Controller and the Player Controller initiates before the Behavior tree.
Honestly, I would suggest not manually setting the blackboard values via your controller. Rather I would have variables in the controller representative of your blackboard keys and use a service to collect the information and set the values to the blackboard within there.
So using your example, have a variable of type String in your player controller. Using whatever logic you have to change that variable. Inside your service, have it continually pull from your player controller those variables setting it to your blackboard keys there.
That’s how I would handle it, hopefully the solution works for you. Let me know if you have any further questions.
EDIT: I see you said you do it on event possess… This is the reason why. The flow of logic as I stated above is causing these values to not be set properly. If you were to run a Print String right before where you set it to see if the blackboard Is Valid, I am almost 100% sure it would say False.