Question on accessing bt variable from non task object

mostlyhuman

Member
I have this code following the documentation:
Code:
        bool isAggressive;
        SharedBool isAggressiveShared;
     
        void Start()
        {
            behaviorTree = GetComponent<BehaviorDesigner.Runtime.BehaviorTree>();
            isAggressiveShared = (SharedBool)behaviorTree.GetVariable("isAggressive");
            isAggressive = isAggressiveShared.Value;
        }
Is isAggressiveShared always needed as an intermediary like this or is there a way to just directly assign behaviorTree.GetVariable("isAggressive") to isAggressive and get rid of isAggressiveShared altogether? Thanks in advance!
 
Top