- Home /
how to move between scenes
I’m working on a sci-fi FPS, it’s all going fine but the amount of lighting I’m using is causing some performance problems. I have fixed this by removing unneeded lights, but if this is harming performance now even high-end comps won’t be able to move if I continue building in the same scene, so I need to change the scene for the different parts of the game. But as my player moves around he will use ammo, take damage, get new guns, and kill things, also he will have to move all over my space station and back into scenes he has already been in, so my problems are.
1: how do I change scenes but keep my players stats (hp, ammo, etc.) the same 2: how do I keep the old scenes the same, (anything that dead stays dead and over all it looks like when the player left the scene 3: how do I do this so the player can easily move from scene to scene (I have lots of doors so I can attach a collider to them
I think this will involve a is trigger and on trigger enter but that’s about all I can think of, and well a script.
I’m not an expert on scripting but I know a bit and I know how to look up parts of a script I don’t understand.
I’m not asking for someone to write me a script (it would be very nice if someone could) but even just telling me what kind of scripting statements I need to look up and read about would help thank you all very much :)
Answer by coastwise · Dec 05, 2012 at 03:19 AM
There are many ways to skin those various cats, but heres what comes to mind:
DontDestroyOnLoad prevents objects (like your player character) from being destroyed when loading a new scene. Can be tricky though...
What you describe requires some form of Persistance. The built-in Unity way is PlayerPrefs, but you might look into some more advanced solutions for saving in the Asset Store.
A trigger, yes. And in the `OnTriggerEnter`, a call to Application.LoadLevel
thanks looks like what i need, tells me what to look into so i can start seting things up.
and you say that i should get a saving asset from the asset store, any recomendations?
Your answer
Follow this Question
Related Questions
The name 'Joystick' does not denote a valid type ('not found') 2 Answers
scene loading 100's of scenes 3 Answers
Scene inside a Scene 3 Answers
How do i Make more levels in my game 2 Answers
Scene object scripting 1 Answer