Search Unity

  1. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  2. Improved Prefab workflow (includes Nested Prefabs!), 2D isometric Tilemap and more! Get the 2018.3 Beta now.
    Dismiss Notice
  3. Want more efficiency in your development work? Sign up to receive weekly tech and creative know-how from Unity experts.
    Dismiss Notice
  4. Participate with students all over the world and build projects to teach people. Join now!
    Dismiss Notice
  5. Build games and experiences that can load instantly and without install. Explore the Project Tiny Preview today!
    Dismiss Notice
  6. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice
  7. Want to see the most recent patch releases? Take a peek at the patch release page.
    Dismiss Notice

How to ensure that a system is the first system to run among other systems?

Discussion in 'Entity Component System and C# Job system' started by davenirline, Dec 7, 2018 at 3:52 PM.

  1. davenirline


    Jul 7, 2010
    I'm making a system that collects commands in an EntityCommandBuffer outside of ECS context (MonoBehaviours). When the systems updates executes, I want a system to playback the collected commands as a starting system. This way, the subsequent systems can filter the newly applied components and entities.

    The current way to do this is to add [UpdateAfter] in every system that I made. This is not maintenance friendly. I would eventually go this route if there's no other way. So is there a way to make a system run first?
    Last edited: Dec 7, 2018 at 4:34 PM
  2. eizenhorn


    Oct 17, 2016
    You can group systems by UpdateInGroup and set UpdateBefore this group for your "first" system. But yes attribute chains it's only way.
  3. 5argon


    Jun 10, 2013
    You may exploit the default that all systems are placed in the Update step, so put your playback system in Initialization step. It works as long as you avoid using Initialization step. *Currently in my game EndFrameBarrier is down below the Update step even though it has Initialization step attribute, not sure what is going on. From the code comment :

    Code (CSharp):
    1.     [UpdateBefore(typeof(Initialization))]
    2.     [Preserve]
    3.     public class EndFrameBarrier : BarrierSystem
    4.     {
    5.     }