Search Unity

  1. Unity 2019.2 is now released.
    Dismiss Notice

Influence Over System Creation Order

Discussion in 'Data Oriented Technology Stack' started by orionburcham, Jan 22, 2019.

  1. orionburcham


    Jan 31, 2010
    Do we have any control over the order in which systems are created?

    We have control over the System update order with attributes like [UpdateBefore()], [UpdateAfter()], [UpdateInGroup()]. Is there an equivalent for system creation order? Or would we need to manually control system creation to do that?

  2. tertle


    Jan 25, 2011
    Not really. The default setup just gets all types in the assembly, filters them and then iterates creating 1 at a time.

    I'm not actually sure how gettypes order is determined, but in theory there might be a way to name[space] your systems to ensure a specific order but that seems extremely hacky.

    If you have get or create manager in on manager created, it'll create that manager at that point which might be ahead of time but still not really giving you a lot of control.

    I'm not sure controlling system order will be something unity supports because systems are usually considered independent, but maybe when they redo the ordering mess they'll might incidentally add it.

    I personally don't control order, but I do create all the systems myself with zenject. This way I can inject factories and other helpers between systems that might need to be setup beforehand without having to worry about system ordering.