How to handle enemy spawning?

Options
Like if I have a RandomSpawner in a level and I load it, then it spawns.

Player 2 joins the room and his RandomSpawner spawns..

I need my spawner to only spawn once per room, not once per player..

How does one go about that?

Comments

  • vadim
    Options
    Spawn enemy on master client only (PhotonNetwork.isMasterClient) with PhotonNetwork.InstantiateSceneObject call (to keep enemies in scene after current master left the room)
  • See, I was thinking that... But nothing was spawning for some reason. I'll try it again, though and see if I wasn't doing anything wrong.. My current setup is this:

    I have a RandomSpawn gameobject that will spawn a random enemy at the objects location. I have a scene PhotonView on the random spawner. Should it have a photonview or no?
  • vadim
    Options
    But nothing was spawning for some reason.
    Nothing is spawned because of PhotonNetwork.InstantiateSceneObject is not called at all or because of error on that call?
    Where do you call it?