- Home /
 
Network.Instantiate instantiazing 2 prefabs
 void OnConnectedToServer() {
     Debug.Log ("Player Connected");
     SpawnPlayer();
     Debug.Log ("Player Spawned");
 }
 
 private void SpawnPlayer() {
     Network.Instantiate(playerPrefab, new Vector3(5f, 5f, 5f), Quaternion.identity, 0);
 }
 
               There are no playerPrefabs in the scene. This is my console log:
 Server Initialized
 Received pong from 192.168.56.1:25000
 Received pong from 192.168.2.105:25000
 Player Connected
 Player Spawned
 There are 2 audio listeners in the scene. Please ensure there is always exactly one audio listener in the scene.
 There are 2 audio listeners in the scene. Please ensure there is always exactly one audio listener in the scene.
 
               What could be causing this?
Answer by tobiass · Nov 27, 2014 at 10:51 AM
I guess you mean:
"When I Instantiate 2 player characters in my game, I get a warning about 2 audio listeners."??
I assume your prefab has an Audio Listener component. In that case, each instantiated character has one and that's one too much. Per client, add the Audio Listener only to the Character that is controlled locally. Or add it to the single cam.
Nope, I can see the two instances of my player prefab in the hierarchy view.
For 2 players or for 1 already? Has each character a audio listener?
Yes I get that warning, that's something to work on later. For now I wanted to spawn only one player, but I'm instancing 2 ins$$anonymous$$d.
Your answer