I'm using the source code for behavior designer and replaced the old Unet with Mirror. When enabling network sync on variables such as vector3, bools etc they all work as expected. However, when I try to network sync Gameobject/transform variables I get a null error.
I simplified my code below but in a nutshell it looks like this.
When setting network sync to true I get a null reference error specifically this below
NullReferenceException: Object reference not set to an instance of an object
BehaviorDesigner.Runtime.SharedVariable`1[T].set_Value (T value) (at Assets/Behavior Designer/Runtime/Variables/SharedVariable.cs:133)
BehaviorDesigner.Runtime.Tasks.SpoonBehaviors.AI.Search.OnUpdate () (at Assets/Runtime/Networking/BehaviorTasks/SpoonBehaviors/AI/Search.cs:33)
BehaviorDesigner.Runtime.BehaviorManager.RunTask (BehaviorDesigner.Runtime.BehaviorManager+BehaviorTree behaviorTree, System.Int32 taskIndex, System.Int32 stackIndex, BehaviorDesigner.Runtime.Tasks.TaskStatus previousStatus) (at Assets/Behavior Designer/Runtime/BehaviorManager.cs:1261)
BehaviorDesigner.Runtime.BehaviorManager.Tick (BehaviorDesigner.Runtime.BehaviorManager+BehaviorTree behaviorTree) (at Assets/Behavior Designer/Runtime/BehaviorManager.cs:1072)
BehaviorDesigner.Runtime.BehaviorManager.Tick () (at Assets/Behavior Designer/Runtime/BehaviorManager.cs:1020)
BehaviorDesigner.Runtime.BehaviorManager.Update () (at Assets/Behavior Designer/Runtime/BehaviorManager.cs:981)
However, I don't get any errors when NetworkSync is set to false...
Again this only happens with SharedGameObjects and Shared Transforms
Anyone know why this could happen?
I simplified my code below but in a nutshell it looks like this.
C#:
public SharedGameObject target;
public override void OnAwake(){
target = (SharedGameObject)Owner.GetVariable("current target");
}
public override TaskStatus OnUpdate(){
target.Value = //Set the target here;
return TaskStatus.Success;
}
When setting network sync to true I get a null reference error specifically this below
NullReferenceException: Object reference not set to an instance of an object
BehaviorDesigner.Runtime.SharedVariable`1[T].set_Value (T value) (at Assets/Behavior Designer/Runtime/Variables/SharedVariable.cs:133)
BehaviorDesigner.Runtime.Tasks.SpoonBehaviors.AI.Search.OnUpdate () (at Assets/Runtime/Networking/BehaviorTasks/SpoonBehaviors/AI/Search.cs:33)
BehaviorDesigner.Runtime.BehaviorManager.RunTask (BehaviorDesigner.Runtime.BehaviorManager+BehaviorTree behaviorTree, System.Int32 taskIndex, System.Int32 stackIndex, BehaviorDesigner.Runtime.Tasks.TaskStatus previousStatus) (at Assets/Behavior Designer/Runtime/BehaviorManager.cs:1261)
BehaviorDesigner.Runtime.BehaviorManager.Tick (BehaviorDesigner.Runtime.BehaviorManager+BehaviorTree behaviorTree) (at Assets/Behavior Designer/Runtime/BehaviorManager.cs:1072)
BehaviorDesigner.Runtime.BehaviorManager.Tick () (at Assets/Behavior Designer/Runtime/BehaviorManager.cs:1020)
BehaviorDesigner.Runtime.BehaviorManager.Update () (at Assets/Behavior Designer/Runtime/BehaviorManager.cs:981)
However, I don't get any errors when NetworkSync is set to false...
Again this only happens with SharedGameObjects and Shared Transforms
Anyone know why this could happen?