Search Unity

  1. Unity 2020 LTS & Unity 2021.1 have been released.
    Dismiss Notice

System groups not appearing in Entity Debugger when using custom worlds

Discussion in 'Data Oriented Technology Stack' started by TFlippy, Apr 21, 2020.

  1. TFlippy

    TFlippy

    Joined:
    Nov 12, 2014
    Posts:
    27
    I'm trying to set up multiple worlds with system groups bound to various PlayerLoop levels, they don't appear inside the Entity Debugger, despite actually being called by the PlayerLoop.

    Using the Unity.Entities.ScriptBehaviourUpdateOrder.UpdatePlayerLoop does bind it inside Entity Debugger, but only for the SimulationSystemGroup, PresentationSystemGroup and InitializationSystemGroup added internally. (com.unity.entities@0.8.0-preview.8\Unity.Entities\ScriptBehaviourUpdateOrder.cs)

    Copying over the exact same code from the package and calling it the same way on the other hand doesn't bind it.

    World initialization with UpdatePlayerLoop (only for the built-in system groups)
    Code (CSharp):
    1.  
    2. this.ecs_world = new Unity.Entities.World(this.ToString());
    3. var playerLoop = PlayerLoop.GetCurrentPlayerLoop();
    4.  
    5. Unity.Entities.ScriptBehaviourUpdateOrder.UpdatePlayerLoop(this.ecs_world, playerLoop);
    6.  
    World initialization with custom code
    Code (CSharp):
    1.  
    2. public void InitializeECS()
    3. {
    4.     this.ecs_world = new Unity.Entities.World(this.ToString());
    5.     var playerLoop = PlayerLoop.GetCurrentPlayerLoop();
    6.  
    7.     for (var i = 0; i < playerLoop.subSystemList.Length; ++i)
    8.     {
    9.         ref var subSystem = ref playerLoop.subSystemList[i];
    10.  
    11.         if (subSystem.type == typeof(Initialization)) this.initializationSystemGroup = this.AddSystem<CustomInitializationSystemGroup>(ref subSystem);
    12.         else if (subSystem.type == typeof(FixedUpdate)) this.fixedUpdateSystemGroup = this.AddSystem<CustomFixedUpdateSystemGroup>(ref subSystem);
    13.     }
    14.  
    15.     PlayerLoop.SetPlayerLoop(playerLoop);
    16. }
    17.  
    18. public T AddSystem<T>(ref PlayerLoopSystem subSystem) where T : Unity.Entities.ComponentSystemGroup, new()
    19. {
    20.     ref var subsystemList = ref subSystem.subSystemList;
    21.     Array.Resize(ref subsystemList, subsystemList.Length + 1);
    22.  
    23.     var system = this.ecs_world.AddSystem(new T());
    24.  
    25.     var playerLoopSystem = new PlayerLoopSystem();
    26.     playerLoopSystem.type = typeof(T);
    27.     playerLoopSystem.updateDelegate = system.Update;
    28.  
    29.     subsystemList[subsystemList.Length - 1] = playerLoopSystem;
    30.  
    31.     return system;
    32. }
    33.  
     
  2. SenseEater

    SenseEater

    Joined:
    Nov 28, 2014
    Posts:
    79
    You should be able to select the custom world from Worlds list in Dropdown on top left corner of Entity Debugger.

     
  3. TFlippy

    TFlippy

    Joined:
    Nov 12, 2014
    Posts:
    27
    It does show up there, but without any systems assigned to it.
     
  4. eizenhorn

    eizenhorn

    Joined:
    Oct 17, 2016
    Posts:
    2,219
  5. snacktime

    snacktime

    Joined:
    Apr 15, 2013
    Posts:
    3,221
    It should fully support custom loop entries. The built in ECS groups are impossible to order around in some cases due to the end command buffer systems being forced last. Probably other use cases as well.
     
unityunity