Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

NetworkVariable<List<GameObject>> declaration causes network crash.

Discussion in 'Scripting' started by NarraAtor, Jul 11, 2021.

  1. NarraAtor

    NarraAtor

    Joined:
    Jul 11, 2018
    Posts:
    11
    I'm working on an online card game and I'm having trouble figuring out why the network keeps crashing when I declare these two variables.

    Here is the relevant code in the class that causes the error:
    Code (CSharp):
    1. public class Hand_Manager : NetworkBehaviour
    2. {
    3.   //The host's hand on the network
    4.     public NetworkVariable<List<GameObject>> Player1Hand = new NetworkVariable<List<GameObject>>(new NetworkVariableSettings
    5.     {
    6.         WritePermission = NetworkVariablePermission.ServerOnly,
    7.         ReadPermission = NetworkVariablePermission.Everyone
    8.     });
    9.    
    10.     //The client's hand on the network.
    11.     public NetworkVariable<List<GameObject>> Player2Hand = new NetworkVariable<List<GameObject>>(new NetworkVariableSettings
    12.     {
    13.         WritePermission = NetworkVariablePermission.ServerOnly,
    14.         ReadPermission = NetworkVariablePermission.Everyone
    15.     });
    16. }
    All game objects that work with the HandManager have a NetworkObject component attached.

    I still get this error messages like this for some reason:
    [MLAPI] NETWORK_VARIABLE_DELTA message received for a non-existent object with networkObjectId: 5. This delta will be buffered and might be recovered.

    Can someone tell me what I am missing here?
     
  2. Bunny83

    Bunny83

    Joined:
    Oct 18, 2010
    Posts:
    3,528
    You haven't really read the documentation, right?

     
    unity_1madloony likes this.
  3. NarraAtor

    NarraAtor

    Joined:
    Jul 11, 2018
    Posts:
    11
    Oh that's embarrassing, thank you for pointing that out for me.
     
  4. Qazuro

    Qazuro

    Joined:
    Aug 4, 2020
    Posts:
    9
    how complex is too complex and what was your solution?