- Home /
Player Spawning Network issue
Hello guys. Sorry for bothering you with those networking problems, I am quite new in Unity, I have seen many tutorials and more than hundred answers here, but nothing solves my problem.
The point is, my server works perfectly, the connection is perfect, but my players do not spawn on each other's view.
What is happening is, the player is spawning at the other player's position (already spawned). This is the Instantiate code that I use: public Transform playerPrefab;
void OnNetworkLoadedLevel()
{
Network.Instantiate(playerPrefab, transform.position, transform.rotation, 0);
}
As you can see, I seted the First Person Controller as playerPrefab, and did NetworkView for the object. And I am running in background
Please help me, glad.
Answer by Matthew0123 · Feb 08, 2013 at 03:55 AM
You need it to be OnConnectedToServer() instead of OnNetworkLoadedLevel(). For the loadedlevel you have to Load the Level for one to spawn and do not recommend using LoadedLevel for anything spawn related cause they can mess up down the road.