PhotonNetwork.InstantiateSceneObject works in editor but not

Options
narfi
narfi
if ((numberThatHaveSpawned < numberToSpawn) && (spawnToggleOnOff == 1) && PhotonNetwork.isMasterClient) {
						PhotonNetwork.InstantiateSceneObject (whatToSpawn1.name, spawnPoint, Quaternion.identity, 0, null);
						numberThatHaveSpawned ++;

				}

This runs just fine in the editor, and will spawn however many creatures I specify.
However if I build the project and start the exe, then it does not.
I have tested starting a built game, connecting with the editor, then connecting with another built game.

Since the first game started is the master client and is not the editor nothing is spawned, but if i exit out of that game and the editor (as the second to connect) becomes the master client then they are spawned and visible on both the editor and the 3rd game connected.

Obviously I don't want to have the editor be required to run as the master client, so how do I get things to instantiate properly in the built games?

Yes, the prefabs are in a Resources folder.

Comments

  • Tobias
    Options
    This should run fine in the editor and in the exported player, too.
    It's important to know if you are the master client. Maybe in testing, you joined a room which had another player in it that didn't time out yet.
    In doubt, add a label showing the "isMasterClient" value.