private void Start() { Instance = this; if (PhotonNetwork.IsMasterClient) { start_button.SetActive(true); } if (allPlayers == null) { Debug.LogError("<Color=Red><a>Missing</a></Color> playerPrefab Reference. Please set it up in GameObject 'Game Manager'", this); } else { // we're in a room. spawn a character for the local player. it gets synced by using PhotonNetwork.Instantiate if (PlayerMovement.LocalPlayerInstance == null) { Debug.LogFormat("We are Instantiating LocalPlayer from {0}", SceneManagerHelper.ActiveSceneName); // thiscount = PhotonNetwork.CountOfPlayers - 1; //thisobj = allcharacters[PhotonNetwork.CountOfPlayers - 1]; // PhotonNetwork.Instantiate(allcharacters[(PhotonNetwork.CountOfPlayersInRooms)%allcharacters.Count].name, spawnpt.transform.position, Quaternion.identity, 0); PlayerIns(); PhotonNetwork.Instantiate(thisobj, spawnpt.transform.position, Quaternion.identity, 0); } } }
public override void OnEnable() { if (gameManager == null) { gameManager = this; } }
private void Start() { Instance = this; Debug.LogAssertionFormat("Local Player is MasterClient: {0}", PhotonNetwork.IsMasterClient); if (PhotonNetwork.IsMasterClient && NetworkedPlayerControllerPhoton.localPlayerInstance == null) { PhotonNetwork.Instantiate(redRobot.name, Spawns[0].transform.position, Quaternion.identity, 0); } else if (NetworkedPlayerControllerPhoton.localPlayerInstance == null) { PhotonNetwork.Instantiate(blueRobot.name, Spawns[1].transform.position, Quaternion.identity * Quaternion.Euler(0f, 180f, 0f), 0); } }