Search Unity

Noob Inject question

Discussion in 'Entity Component System' started by StefanaUnity, Apr 9, 2019.

  1. StefanaUnity

    StefanaUnity

    Joined:
    Apr 9, 2019
    Posts:
    18
    Hello my name is stefana I'm fairly new to ECS. I used an older version of ECS and my code depends on Inject but it's obsolete in the latest version.

    The only way I know to get access to other systems data is using inject. I've looked around but I can't figure out how to get data from one system to another anymore.

    Thank you for taking time out :)
     
  2. GilCat

    GilCat

    Joined:
    Sep 21, 2013
    Posts:
    676
    Code (CSharp):
    1.   MySystem m_injectedSystem;
    2.   protected override void OnCreate() {
    3.     base.OnCreate();
    4.     m_injectedSystem = World.GetExistingSystem<MySystem>();
    5.   }
     
    StefanaUnity likes this.
  3. StefanaUnity

    StefanaUnity

    Joined:
    Apr 9, 2019
    Posts:
    18
    Thank you! Am I missing something? Is there something better then Entities.ForEach? is Entities.ForEach even performance friendly?

    Code (CSharp):
    1.         Entities.ForEach((Entity entity, Transform zzz) =>
    2.         {
    3.             Debug.Log(zzz.name);
    4.  
    5.  
    6.         });
     
    Last edited: Apr 9, 2019
  4. StefanaUnity

    StefanaUnity

    Joined:
    Apr 9, 2019
    Posts:
    18
    Do you know what this error is?

    Code (CSharp):
    1. Ignoring invalid [UpdateAfter] dependency for NewBehaviourScript: UnityEngine.Experimental.PlayerLoop.FixedUpdate must be a member of the same ComponentSystemGroup.
    2.