I’m a little undecided on this one! Basically, I am loading the HUD on level start, and I have tried 2 different approaches.
My first approach was to create different HUD prefabs eg; HUD_TILT_CONTROLS.prefab, HUD_TOUCH_CONTROLS.prefabs, ect…
Then I use a ControlsManager class where I assign all different HUD prefabs to an array of GameObject, in the editor. Than at runtime, I Instantiate() the chosen HUD prefab, and if the user changes the HUD in the pause menu for example, I then Destroy() the current HUD prefab in the scene, and Instantiate() the new one chosen by the user. This approach works fine, but I don’t like the fact that the Instantiated HUD GameObject is a (clone), and I try not to Instantiate() too many things when I don’t have to.
My second approach is to create new scenes for each HUD preset, and depending on the user’s choice, I load the corresponding scene with LoadLevelAdditive(). I got the idea from the Penelope IOS tutorial. The nice thing about this approach is that I could also throw in other GameObjects in each scene, like the player for example, that way I can do all my testing/tweaking in each HUD scene without having to mess with the actual level scenes. And a bonus, at least in my mind, is that I don’t have to Instantiate() anything, and I get the actual GameObject(s), instead of clones.
Is one approach better then the other? Like performance-wise, or organization-wise? What do you guys recommend for loading HUDs at runtime?
Thanks for your time!