Spawning Player in Singleplayer
I am looking for a way to spawn a player on spawn points in my map, similar to using a Network Manager/Network Start Position combo, but in Singleplayer, due to the project being a Singleplayer Game. All tutorials I looked up only does multiplayer, which, while good information, and something I have worked with before, is not what I'm looking for. Any ideas?
I'm not sure I'm understanding the question. You say you want to spawn a player in a single player game and I don't know the specifics of the network manager (and other unity networking components) but if the game is single player and not networked then couldn't you just do something like this?
Instantiate(playerPrefab,spawnPosition);
Answer by unity_21erushbrook · May 25, 2018 at 09:20 PM
You can place empty gameobjects where you whant each spawn point to be, put them all in a parents empty gameobject, make a new C# script. You then want to put in the script to get all the gameobjects in children’s transforms and assign them to a string array. Select one of them at random and set the transform of the character to the transform of the empty gameobject.
Ask me if you need help doing this.
Put all of that into a new void and call it when you want to ‘respawn’