Author Topic: Recommended way to handle loading multiple menu screens with LoadLevelAdditive?  (Read 5347 times)

Meltdown

  • Jr. Member
  • **
  • Thank You
  • -Given: 10
  • -Receive: 0
  • Posts: 56
    • View Profile
My game has quite an extensive menu with lots of atlases etc.
What I'm trying to avoid is having everything in one scene. So I am putting each menu in it's own scene and using LoadLevelAddditiveAsync to load the new menu as it's needed, and destroy any other menu no longer needed.

Now what I can't seem to avoid is having multiple UIRoots/Cameras from this.

I was just wondering if there are any known issues when taking this approach, or will this be ok?
I will only have max 2-3 menus loaded at the same time.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
If you want to split up the UI like that and still have only one root/camera, the solution is to have your additively loaded UI hierarchy disabled entirely, with some script referencing to the root object just below your UIRoot (which should be disabled).

When the scene loads in, access this root object and reparent it to your existing UI, enable its game object, and destroy the duplicated UIRoot game object.