Search Unity

[Tutorial] Unity ECS: Pure vs Hybrid (including a walkthrough)

Discussion in 'Community Learning & Teaching' started by charlesamat, Apr 9, 2018.

  1. charlesamat

    charlesamat

    Joined:
    Feb 5, 2014
    Posts:
    66
  2. Matt1988

    Matt1988

    Joined:
    Sep 14, 2012
    Posts:
    23
    Hi Charles! This was a great video and it has helped loads in understanding the new ECS system. I do however have a question that your video didn't answer for me (Or I just plain missed it altogether). I'm going through the Twin Stick Shooter sample that Unity has on their Github, and I am finding [Inject] Attributes all over the place. Do you know how this dependancy injection works?

    Example:
    Code (CSharp):
    1. public struct PlayerData
    2.         {
    3.             public int Length;
    4.             public ComponentArray<Position2D> Position;
    5.             public ComponentArray<PlayerInput> PlayerInput;
    6.         }
    7.  
    8.         [Inject] private PlayerData m_Player;
    If this is as simple as I think it may be, is it similar to using GetEntities<PlayerData>?
     
  3. Matt1988

    Matt1988

    Joined:
    Sep 14, 2012
    Posts:
    23