- Home /
Question by
skylitcoding · Mar 27, 2021 at 12:54 AM ·
performance optimizationscene-switchingtransitiondontdestroyonload
is it more performant to have an instance of one object in every scene or just a dontdestroyonload object?
I'm working on a transition system and watched a tutorial from Brackeys. What they did is put an object called LevelLoader in every scene. The LevelLoader animates a Canvas where the Entry is a fade in and the Ending is a fade out that plays before a scene is switched. When the scene switches, the animation goes back to Entry and fades in again. Since I'm building a game consisting of quite a few levels, I was wondering if it was more performant to figure out a way to have the LevelLoader in the DontDestroyOnLoad group or just put it in every scene.
Comment
I think it is a question of ram vs cpu, keeping it memory uses ram, but instantiating uses cpu, depends on what is best for your game.
Your answer
![](https://koobas.hobune.stream/wayback/20220613031346im_/https://answers.unity.com/themes/thub/images/avi.jpg)