- Home /
spawn position after application.loadlevel
How would i go about setting the spawn position after application.loadlevel?
thanks
what do you mean exactly? How to define a spawn position for your level? or how to set your player to a known spawn position?
ive got a player in a different scene that uses dont destroy on load, so the player is not in the scene, i have 12 triggers to enter different scenes and i would like it to return back to where it triggered, does that make sence
Answer by tw1st3d · Aug 20, 2013 at 08:50 PM
The "spawn" position is wherever the camera is in the scene, so you just put your camera wherever your spawn point is.
ive got a player in a different scene that uses dont destroy on load, so the player is not in the scene, any ideas?
/* C# */
public GameObject player;
void Awake()
{
Instantiate(player, new Vector3(), Quaternian.identity);
}
Answer by Joyrider · Aug 20, 2013 at 09:04 PM
You could save the triggered objects' name, or position, either in the playerPrefs or in a variable of a script on the player, since he doesn't get destroyed on load.
And once your previous scene is loaded again, you just look for that trigger object and set your player to that position.
Your answer
![](https://koobas.hobune.stream/wayback/20220613112629im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
i need help making a log in system 0 Answers
Current scene number 2 Answers
how to load random level but one? 3 Answers
Loading a level on contact 2 Answers
Loading Scene on a series of events 2 Answers