Search Unity

Third Party Mirror Networking error

Discussion in 'Multiplayer' started by Epikgamer64, Apr 21, 2022.

  1. Epikgamer64

    Epikgamer64

    Joined:
    Sep 17, 2021
    Posts:
    6
    Hi everybody, I have this problem with my code. When I enter if(GetComponent<NetworkIdentity>().isLocalPlayer) in the console it says, "The type or namespace name 'NetworkIdentity' could not be found (are you missing a using directive or an assembly reference?)" I have a NetworkIdentity on my player but the error still occurs.
     
  2. Epikgamer64

    Epikgamer64

    Joined:
    Sep 17, 2021
    Posts:
    6
    Here is my code:
    Code (CSharp):
    1. using UnityEngine;
    2. using UnityEngine.Networking;
    3.  
    4. public class PlayerSetUp : MonoBehaviour
    5. {
    6.  
    7.     Behaviour[] componentsToDisable;
    8.  
    9.     void Start()
    10.     {
    11.         if(GetComponent<NetworkIdentity>().isLocalPlayer)
    12.         {
    13.             for (int i = 0; i < componentsToDisable.Length; i++)
    14.             {
    15.                 componentsToDisable[i].enabled = false;
    16.             }
    17.         }
    18.     }
     
  3. Epikgamer64

    Epikgamer64

    Joined:
    Sep 17, 2021
    Posts:
    6
    Sorry, Just realized that you can just put using Mirror; under using UnityEngine; Hope I have saved others the trouble