When multiple BehaviorTreeReferences are executed, shared variables unexpectedly have the same value.

Kobayashi

New member
We apologize if the wording is unclear due to the use of Google Translate. We report the behavior as a possible bug.

The configuration of the problem is as follows:
-Adding a BehaviorTree component to a GameObject and connecting a BehaviorTreeReference to that BehaviorTree's Entry.
-In this BehaviorTreeReference, we refer to ExternalBehavior1.
-In ExternalBehavior1, there are three BehaviorTreeReferences, each referring to LogBehavior.
-The Variables of these BehaviorTreeReferences are set to shared variables (test1, test2, test3) whose Name is text and whose Value is a different string type.
In -LogBehavior, there is a shared variable "text" of type string, and the shared variable "text" is set to Text in the Log of this task.

The expected behavior is that the three LogTasks output different text (test1, test2, test3) in the log during play, but in reality all LogTasks output the log with the value of test1.

Thank you in advance for your help.
 

Attachments

This is as designed, though I can see it being confusing. When you have a variable with the same name it is only going to have a single value, even if it gets inherited to the referenced trees. There is only one variable reference.

I have been making improvements to how variables are passed to referenced trees and it's a much better flow in the dots version of Behavior Designer. In this situation there are now independent values for each referenced tree. I don't want to change it in the current version because that would change the functionality for people whose projects depend on the current implementation.
 
Back
Top