1402912: Having object selected in editor can cause network variable to overreplicate.

Hit a very strange issue where an object started behaving erratically while playing the game when selected an object in the inspector and discovered the following stack trace. It seams that the editor is causing “OnValueChanged” to trigger even though I’m not actively changing the value. Unselecting the object in editor returns the behavior to normal.

Note don’t worry about errors on video connected to bug they are logs of me trying to figure out what the hell was going on.
Video: unitybug.mov - Google Drive

(The erratic behavior is my AI thinking the turn started over and over and over. )

Starting AI
UnityEngine.Debug:Log (object)
Game.NetworkedActorControlled:StartTurnAI () (at Assets/Game/Scripts/Shared/Actor/NetworkedActorControlled.cs:76)
Game.NetworkedActorControlled:StartTurn () (at Assets/Game/Scripts/Shared/Actor/NetworkedActorControlled.cs:62)
Game.NetworkedActorControlled:OnIsTurnChanged (bool,bool) (at Assets/Game/Scripts/Shared/Actor/NetworkedActorControlled.cs:44)
Unity.Netcode.NetworkVariable`1<bool>:Set (bool) (at Library/PackageCache/com.unity.netcode.gameobjects@1.0.0-pre.5/Runtime/NetworkVariable/NetworkVariable.cs:137)
Unity.Netcode.NetworkVariable`1<bool>:set_Value (bool) (at Library/PackageCache/com.unity.netcode.gameobjects@1.0.0-pre.5/Runtime/NetworkVariable/NetworkVariable.cs:128)
Unity.Netcode.Editor.NetworkBehaviourEditor:RenderNetworkVariableValueType<bool> (int) (at Library/PackageCache/com.unity.netcode.gameobjects@1.0.0-pre.5/Editor/NetworkBehaviourEditor.cs:145)
System.Reflection.MethodBase:Invoke (object,object[])
Unity.Netcode.Editor.NetworkBehaviourEditor:RenderNetworkVariable (int) (at Library/PackageCache/com.unity.netcode.gameobjects@1.0.0-pre.5/Editor/NetworkBehaviourEditor.cs:73)
Unity.Netcode.Editor.NetworkBehaviourEditor:OnInspectorGUI () (at Library/PackageCache/com.unity.netcode.gameobjects@1.0.0-pre.5/Editor/NetworkBehaviourEditor.cs:174)
UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)

This is causing major issues now. I cannot select an object in editor in some cases without completly breaking the game.

In this case it thinks I’m ending an encounter, and forcing a scene to unload. All I’m doing is selecting the object in heirarchy.

Please submit this via the Unity bug reporter and we’ll have a look.

(Case 1410758)

1 Like