Multiple scenes

    This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

    • Multiple scenes

      Hello, first post here

      First i would like to thank Mr. Mike and Rez for writing such a great and awesome piece of knowledge. I've got the 3rd edition when it got out and have now ordered the 4th.

      I have a question about the scenes and views, it seems to me that once a Render Component is created it will be attached to any scene that exists in the game via the EvtData_New_Render_Component. In teapotwars theres only one scene from teapotwarsview so this doesn't happen.

      Does this make sense? If for example we had a MainMenuView that contains a scene won't actors from other scenes end up there?
    • Thanks man!

      You are correct, once a render component is created, it will be attached to any active scenes. The architecture assumes that only one scene is ever in existence at a time, or that you're happy attaching all new render components to each scene (for split-screen or multi-camera games like Indigo Prophecy).

      If you expect to have multiple scenes alive and didn't want to attach everything to them (such as creating a MainMenuView that existed in parallel with the game view), you could create another event, like EvtData_New_Main_Menu_Node or something similar and have each scene register only for the appropriate event.

      -Rez
    • You could also add a parameter to the new render component event, specifying a "Layer", with a given scene rendering one layer. The current architecture hacks this together a bit by specifying Render_Pass, but I've come to realize that separate scenes, each rendering on a user defined layer is a superior design.

      Of course, Unity uses this idea. It sure makes things easy, especially when you want to easily turn off a particular layer for debugging, performance, or a special effect.
      Mr.Mike
      Author, Programmer, Brewer, Patriot