PhotonNetwork.InstantiateSceneObject works in editor but not in build

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.

That line can only be called by masterclient. And in the editor you are always the master but not in build. You should check if you aren’t masterclient then send rpc to masterclient to instantiate sceneobject.

Maybe you already have figured this one out, but just to let everyone know.

GameObject blabla = PhotonNetwork.InstantiateSceneObject (“PrefabName”, transform.position, transform.rotation,0,null);

Attach script to gameObject spawn spot.