Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice

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

Discussion in 'Netcode for GameObjects' started by hoesterey, Feb 13, 2022.

  1. hoesterey

    hoesterey

    Joined:
    Mar 19, 2010
    Posts:
    659
    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: https://drive.google.com/file/d/1OnMa2XtKBBFgNTrLGAyCkcTtpruGmWv4/view?usp=sharing

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


    Code (CSharp):
    1. Starting AI
    2. UnityEngine.Debug:Log (object)
    3. Game.NetworkedActorControlled:StartTurnAI () (at Assets/Game/Scripts/Shared/Actor/NetworkedActorControlled.cs:76)
    4. Game.NetworkedActorControlled:StartTurn () (at Assets/Game/Scripts/Shared/Actor/NetworkedActorControlled.cs:62)
    5. Game.NetworkedActorControlled:OnIsTurnChanged (bool,bool) (at Assets/Game/Scripts/Shared/Actor/NetworkedActorControlled.cs:44)
    6. Unity.Netcode.NetworkVariable`1<bool>:Set (bool) (at Library/PackageCache/com.unity.netcode.gameobjects@1.0.0-pre.5/Runtime/NetworkVariable/NetworkVariable.cs:137)
    7. 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)
    8. Unity.Netcode.Editor.NetworkBehaviourEditor:RenderNetworkVariableValueType<bool> (int) (at Library/PackageCache/com.unity.netcode.gameobjects@1.0.0-pre.5/Editor/NetworkBehaviourEditor.cs:145)
    9. System.Reflection.MethodBase:Invoke (object,object[])
    10. Unity.Netcode.Editor.NetworkBehaviourEditor:RenderNetworkVariable (int) (at Library/PackageCache/com.unity.netcode.gameobjects@1.0.0-pre.5/Editor/NetworkBehaviourEditor.cs:73)
    11. Unity.Netcode.Editor.NetworkBehaviourEditor:OnInspectorGUI () (at Library/PackageCache/com.unity.netcode.gameobjects@1.0.0-pre.5/Editor/NetworkBehaviourEditor.cs:174)
    12. UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)
     
  2. hoesterey

    hoesterey

    Joined:
    Mar 19, 2010
    Posts:
    659
    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.
    upload_2022-3-8_15-14-16.png
     
  3. luke-unity

    luke-unity

    Joined:
    Sep 30, 2020
    Posts:
    306
    Please submit this via the Unity bug reporter and we'll have a look.
     
  4. hoesterey

    hoesterey

    Joined:
    Mar 19, 2010
    Posts:
    659
    (Case 1410758)
     
    luke-unity likes this.