Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Inject replacement for Barrier injection

Discussion in 'Entity Component System' started by Sibz9000, Feb 17, 2019.

  1. Sibz9000

    Sibz9000

    Joined:
    Feb 24, 2018
    Posts:
    149
    I see on the github documentation that [inject] is on the way out, however there's no specified replacement for Barrier injects.

    Is there one, or not yet?
     
  2. tertle

    tertle

    Joined:
    Jan 25, 2011
    Posts:
    3,753
    Code (CSharp):
    1.         protected override void OnCreateManager()
    2.         {
    3.                 this.barrier = this.World.GetOrCreateManager<EndFrameBarrier>();
    Code (CSharp):
    1.         protected override JobHandle OnUpdate(JobHandle handle)
    2.         {
    3.                 // queue jobs
    4.                 handle = default(Job).Schedule(this, handle);
    5.                 this.barrier.AddJobHandleForProducer(handle); // pass final handle to barrier to ensure dependency completion
    6.                 return handle;
    7.         }
     
    ilih, NotaNaN, Deleted User and 9 others like this.