Why **if (!isLocaLPlayer)** is errors??
using UnityEngine; using UnityEditor.Networking;
public class PlayerSetup : MonoBehaviour {
[SerializeField]
Behaviour[] componentsToDisable;
void Start ()
{
if (!isLocaLPlayer)
{
for (int i = 0; i < componentsToDisable.Length; i++)
{
componentsToDisable[i].enabled = false;
}
}
}
}
Why if (!isLocaLPlayer) is errors??
Comment
Answer by Jawchewa · May 03, 2017 at 03:15 AM
isLocalPlayer is a property of NetworkBehaviours. You have it set as a MonoBehaviour.
Try changing your class declaration from this:
public class PlayerSetup : MonoBehaviour {
to this:
public class PlayerSetup : NetworkBehaviour {
Oh, also, I just noticed an issue with isLocaLPlayer. The second "L" Should be lowercase. So make it "isLocalPlayer".