Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

Question Questions about Entities.World

Discussion in 'DOTS Dev Blitz Day 2022 - Q&A' started by BuzzJive, Dec 7, 2022.

  1. BuzzJive

    BuzzJive

    Joined:
    Mar 6, 2014
    Posts:
    75
    This works for me when creating a new world and spawning entities in it. The world only shows up when I call that last part of AppendWorldToCurrentPlayerLoop

    Code (CSharp):
    1. var systems = DefaultWorldInitialization.GetAllSystems(WorldSystemFilterFlags.Default);
    2. DefaultWorldInitialization.AddSystemsToRootLevelSystemGroups(myWorld, systems);
    3. ScriptBehaviourUpdateOrder.AppendWorldToCurrentPlayerLoop(myWorld);
    I tried to later call ScriptBehaviourUpdateOrder.RemoveWorldFromCurrentPlayerLoop(myWorld); and it does not remove the world from view. That world still renders all the entities. I know I can DestroyEntity in there to destroy them all, but I essentially just want to turn a world off. Is there a way to make that happen?


    Second question is is there is a way to specify that a World will be visible or not to a specific camera? Something like adding a world to a render layer or being able to specify per camera which worlds to render.
     
    TheOtherMonarch likes this.
  2. TheOtherMonarch

    TheOtherMonarch

    Joined:
    Jul 28, 2012
    Posts:
    888
    When you say a world shows up when you AppendWorldToCurrentPlayerLoop you mean in the editor, correct? Also, if that is the case, what is not showing up the entity inspector or the systems inspector? My multi-world test project is still halfway between 0.5 and 1.0.

    I know in 0.5 custom worlds have issues showing up correctly in the editor, unless they use AppendWorldToCurrentPlayerLoop, which effects debugging manually updated worlds. It sounds like worlds are also not getting removed from the editor correctly.

    Will the editor support multi-worlds better in the future?
     
    Last edited: Dec 8, 2022