/** * Update- called once per frame. If the land has not been initialized yet, attempt to initialize it ourselves once it is * Photon instantiated. * If the player manager has not been added to the Network Manger yet, attempt to find it and add this client's player to it. */ void Update() { if (land == null) { attemptToSpawnLand(); } if (players == null && PlayerManagerScript.FindObjectOfType <PlayerManagerScript> () != null) { players = PlayerManagerScript.FindObjectOfType <PlayerManagerScript> (); giveGUIManager(); player.transform.gameObject.GetComponent <PhotonView> ().RPC("addToPlayerManager", PhotonTargets.AllBuffered, new string[] {}); } }
public void addToPlayerManager() { Debug.Log("Adding player to player manager"); PlayerManagerScript manager = PlayerManagerScript.FindObjectOfType <PlayerManagerScript> (); if (manager == null) { Debug.LogError("Could not find the player manager."); return; } manager.addPlayerToList(this); managerScript = manager; }