- Home /
Stacking level blocks in an Infinite runner game
I'm making a casual runner game in which I'll create many levels and stack them randomly one after another as the player moves. Each level consists of a ground block with manually placed obstacles. These items will vary in size and shape, so its important to do it manually. I could think of the following ways to do the job:
1) Make a prefab for each level and instantiate/destroy them 2) Make all levels at the gameplay scene and enable/disable them (~50 levels) 3) Make each level as a scene and load them on the gameplay scene in additive mode
Since I'm new to unity I don't know which one of this methods is costlier in terms of memory and CPU. I'm targeting mobile, so performance is important. Anyone has an idea of what is the best approach? Thanks for the help!
Answer by hectorux · Nov 10, 2018 at 12:28 AM
Having something like a pool will cost cpu, but it wont have a very big drop in fps like when you instance/Destroy, adding scenes is not a very optimal option
Answer by luisgualandi · Nov 10, 2018 at 02:31 PM
@hectorux Thanks for the info. So adding scenes more costly than prefabs? Maintaining a pool of 50 levels doesn't sound smart to me. What option would you choose?
In your case, depending on how meny times you would instantiate or activate those lvls, if they are small, and you do it frecuently, ithink that a pool isnt something pretty crazy(also remember to set thos unactive to better performance), if they are big, when you instantiate one, you will have a little fps drop, but ins$$anonymous$$d of having all pre-charged, will cost less CPU meanwile. Conclusion: small/meny-active(less fps media), big/some-instantiate(more ps media, but with drops(in your case maybe 4fps(i mean it isnt something that big, isn`t it?)))
Really the levels chuncks are pretty small, but will be called frequently(every ~4 sec). I think instantiating or async loading scenes won't have much impact on fps, but I'm not sure. Also apparently if I were to use prefabs I'd have to download the new beta version of Unity with nested prefabs.
there is a plugin of nested prefab in the aset stroe(if i dont remeber well ithink is free)
Your answer
Follow this Question
Related Questions
How do I make a bowling ball curve and gain friction in certain points? 0 Answers
How to drag and move a character left and right using touch controls in an endless runner game? 0 Answers
How can i rotate 3D object with joystick in all directions? 0 Answers
2d or 3d for better perform on mobile devices? 1 Answer
Which is better? Switching out Textures or Instantiating Different prefabs? 1 Answer