- Home /
Level transition 2d runner game mobile
How can we transition from one level to another in a side scroll runner without loading a new scene.
The method that I'm using is:
Edit the game object in the editor (move, scale, rotate) whatever.
Press apply to the gameObject to reflect the changes to the prefab
Then disable the gameobject
My ResourceManager.cs will do the work and instantiate a copy of the gameobject at runtime when I want (maybe it will generate a problem related with gameObject references).
My question is there a better way to solve this issue? I'm trying to not overuse memory. The bad thing is that I have a lot of gameObjects for one level. I think that should be a faster and better way to do it.
what would be helpful is a screenshot of your hierarchy? That way we can see if certain methods will conflict with the items you have.
Answer by Leuthil · Mar 26, 2014 at 05:12 PM
Funny thing is that I'm actually doing something very similar in my current project. I will tell you right now that from my tests and findings, using Instantiate to load Prefabs causes a significant game freeze for a split second that is very noticeable (at least on mobile, I'm testing on Android at the moment).
I am now trying to convert my system to a pooling system. Basically it was load a couple of each type of prefab when the game first starts and deactivate them until needed. Once one is needed, it will reactivate and move it into the correct spot. Once that prefab instance goes off-screen I deactivate it again.
Answer by warfronts · Mar 27, 2014 at 07:55 AM
Mmmmm... yes I could have all objects here (level0, level1, ... leveln) and only activate the ones that I need but, I think this is a bad approach because it will be a lot of Inactive GameObjects taking memory.
The way i would like to do it when changing to level0 to level1 was like "removing all objects from level0" instantiating all objects from level1.
I still thinking the best way to do it.
Thanks for your answer.
You can try it but you will notice the game freeze while it Instantiates all those objects.
Your answer
Follow this Question
Related Questions
Mobile input problem for first-person shooter 0 Answers
Profiler says that game is running at 10ms(100FPS) but on mobile runs at 45FPS. 2 Answers
Is it ok to have just one scene for a whole game? 0 Answers
spawn points/ player transition from level to level with multiple exits and entrances 3 Answers
Why Unity has high memory usage on empty scene? (Android) 1 Answer