Search Unity

For the time being, are we supposed to keep using Inject?

Discussion in 'Entity Component System' started by foxnne, Dec 18, 2018.

  1. foxnne

    foxnne

    Joined:
    Apr 18, 2016
    Posts:
    59
    I've been trying to learn more and I've hit a point where I want to create entities after I initialize.

    To do this through a job, my understanding is that you need to use a barrier and command buffer. Every single example Ive seen though used Inject for the barrier. At the same time, i keep reading that Inject will be deprecated really soon and to avoid it.

    Is there no other option right now though? I'm still trying to wrap my head around it all. forgive me if I'm being ignorant.

    Also, it seems that IJobProcessComponentData is the best way to write a job for the time being, at least for most cases from what I've seen.

    Does this mean typically, no matter how simple the task, that's the best way to go about it? Example being player input. There only will ever be one, is it a waste to use this?
     
  2. tertle

    tertle

    Joined:
    Jan 25, 2011
    Posts:
    3,759
  3. foxnne

    foxnne

    Joined:
    Apr 18, 2016
    Posts:
    59
  4. Spy-Shifty

    Spy-Shifty

    Joined:
    May 5, 2011
    Posts:
    546
    I don't know if this is working for barriers too, but it does work for systems and a barrier is a special system...
    Code (CSharp):
    1. EntityManager.GetOrCreateManager<EndFrameBarrier>()
    EDIT:

    Ah I see there are some issues with the job system...
    So @tertle has already given you the correct answer....
     
    Last edited: Dec 18, 2018
    foxnne likes this.