Set sharedvariable and GlobalVariable:
The Sharedv above is sharedvariable, and the variable range is the current behavior tree;
The following globalv is GlobalVariable, and the variable range is all the behavior tree.
The difference between sharedvariable and ordinary variables:
Sharedvariable can refer to the variables set above, eliminating the drag operation, if the same object is referenced by multiple nodes, you can set the object to Sharedvariable
Using Unityengine;namespace behaviordesigner.runtime.tasks.basic.unitygameobject{ [Taskcategory ("Basic/ Gameobject ")] [Taskdescription (" Test Sharedgameobject ")] public class task1:conditional { public Sharedgameobject Sharedgameobject; Public Gameobject A; Public sharedproperty sharedproperty; }}
Custom sharedvariable:
Using Unityengine;public class property:monobehaviour{public int nowhp =; public int maxhp = 100;}
Using unityengine;using system.collections;namespace behaviordesigner.runtime{ [system.serializable] public class Sharedproperty:sharedvariable {public Property Value {get {return mvalue;} set {Mvalue = value ; }} [Serializefield] private property mvalue; public override Object GetValue () {return mvalue;} public override void SetValue (object value) {Mvalue = [property] value;} public override string ToString () {return (Mvalue = = null?) "NULL": Mvalue.name); } public static implicit operator SharedProperty (property value) {var sharedvariable = new SharedProperty (); Sharedv Ariable. SetValue (value); return sharedvariable; } }}
[Unity plugin] Behavior designer:sharedvariable and GlobalVariable