Spawn enemies AI
Options
Hi everyone I'm beginner in Unity and Photon, so I've a problem with the enemies AI spawning.
I create a NetworkManager with Photon.Monobehaviour and a method SpawnEnemy() when the number of enemies is lesser then MAX_NUMBER_ENEMIES, but I received this error "Failed to Instantiate prefab: Prefabs/Enemy. Client should be in a room." and I don't understand what it is.
I create a NetworkManager with Photon.Monobehaviour and a method SpawnEnemy() when the number of enemies is lesser then MAX_NUMBER_ENEMIES, but I received this error "Failed to Instantiate prefab: Prefabs/Enemy. Client should be in a room." and I don't understand what it is.
0
Comments
-
Hi @Danny07,
this message tells you, that the client hasn't joined a room yet. You can only instantiate network objects (usingPhotonNetwork.Instantiate(...)
) when being in a room.
I would strongly recommend you taking a look at the Basics Tutorial and work through it to get the idea behind Lobbies and Rooms and a general overview how PUN works.0