Question by
snon200 · Apr 07, 2016 at 05:43 PM ·
unity 5errornetworking
The name `isLocalPlayer' does not exist in the current context
hi, can someone please help me and let me know why im getting this error? thanks.
Assets/PlayerSetup.cs(11,14): error CS0103: The name `isLocalPlayer' does not exist in the current context
using UnityEngine;
using UnityEngine.Networking;
public class PlayerSetup : MonoBehaviour
{
[SerializeField]
Behaviour[] componentsToDisable;
void Start()
{
if (!isLocalPlayer)
{
for(int i = 0; i < componentsToDisable.Length; i++)
{
componentsToDisable[i].enabled = false;
}
}
}
}
Comment
Best Answer
Answer by QuintonH · Apr 07, 2016 at 05:50 PM
You're inheriting your PlayerSetup class from the MonoBehaviour class, you should be inheriting from NetworkBehaviour.
Link to NetworkBehaviour documentation with example: http://docs.unity3d.com/ScriptReference/Networking.NetworkBehaviour-isLocalPlayer.html
Answer by unity_DA0A7C5DC4CBE3FA9647 · Apr 29 at 10:31 AM
Just type up there right before using using UnityEngine; using Mirror;
Your Error Will be solved ...........! Enjoy