- Home /
Character Loading Location
I have a series of Levels. They are activated by walking through collision boxes which then loads the next scene(Pretty simple)
The problem I'm having is that when I load from "Scene 2" back to "Scene 1" it naturally spawns the character at the origional game starting location. I want it to spawn him right outside the door (the door that leads between scene 1 and 2)
I'm trying to work the script but I just don't know how to do it.
Answer by StephanK · Mar 05, 2010 at 09:25 AM
In your levels you should define spawn points at every "door". Then you can create a GameObject that "survives" Application.LoadLevel(). You can do this by calling GameObject.DontDestroyOnLoad(MyObject).
In that GO you could store something like lastLevel. Now if you load a new level you can look up last level and spawn the player at the correct spawn point.
Nothing i do seems to be working. I Understand the concept. But everything I try ends in the same results I'm having. Something's just not working. It's putting a big halt on my game project.
Can you describe what's happening or what exactly is not working? What's the result you are having?
I don't know exactly, I guess I just dont' know how to make spawn points, and then tell the system, "when you load Scene 1, from Scene 2, Place Character here, but when you load scene 1 from scene 3, place him here ins$$anonymous$$d.". That's pretty much exactly what I'm looking for at the moment.
Answer by Ty1ensen · Jan 31, 2013 at 11:52 PM
you could duplicate all scenes and put you character in the places you want to spawn them in and make the script load the scene that has the right spawn in it. alot of work but thts what i do plus im a terible scripter so i do the stuuf like that prety much all the time