Search Unity

Built-in way to get a System's execution order

Discussion in 'Entity Component System' started by PublicEnumE, Feb 5, 2019.

  1. PublicEnumE

    PublicEnumE

    Joined:
    Feb 3, 2019
    Posts:
    729
    Is there a built-in API to get a ComponentSystem, JobComponentSystem, or BarrierSystem's execution order?

    I didn't see one in the source code. I wanted to double check before implementing a custom solution.
     
  2. Spy-Shifty

    Spy-Shifty

    Joined:
    May 5, 2011
    Posts:
    546
    I think it's just
    World.BehaviourManagers.

    But you can also take a look at the implementation of EntityDebugger Window
     
  3. GilCat

    GilCat

    Joined:
    Sep 21, 2013
    Posts:
    676
    You can always do a linq query on the managers like this:
    Code (CSharp):
    1.     var orderedSystems = World.Active.BehaviourManagers
    2.       .OfType<ComponentSystemBase>()
    3.       .OrderBy(m => m.LastSystemVersion)
    4.       .ToList();