- Home /
Reloading level or re-positioning player and objects?
Hello.
What would be the best method to reload a 2d level for best performance.
Would it be to use Application.loadlevel(application.LoadedLevel);?
or to move the player and all other objects back to it's start position and re-enable objects that have been disabled?
Thanks for reading
-Frank
Answer by rutter · Feb 21, 2014 at 02:16 AM
There's no single answer to cover this for every possible project.
Resetting a level is almost always more dev work. Sometimes a lot more. It is often faster if the level is simple enough.
There is certainly value in keeping load times low, especially for mobile development, but you need to weigh that against the development and memory requirements of tracking and restoring enough state to viably reset a level, and the difficulty there depends quite a bit on the particulars of your game.
tl;dr: Worth it sometimes.
The only thing happening in my game is the player running to the left(2d endless runner game) and picking up coins with a monster chasing him and some ground objects being disabled when they're behind the player. $$anonymous$$aking an array with all gameobjects and setting them to active and resetting the score would probably be easy and ok for performance.
Answer by morgan23 · Feb 21, 2014 at 02:14 AM
I think application.loadlevel(application.loadedlevel) is what your looking for if your just resetting the level.
Your answer
Follow this Question
Related Questions
Renderer on object disabled after level reload 1 Answer
How to load a scene with playerprefs from a ui element 1 Answer
Multiple Cars not working 1 Answer
PlayerPrefs issue 2 Answers
Distribute terrain in zones 3 Answers