Search Unity

  1. Unity 2019.1 beta is now available.
    Dismiss Notice
  2. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  3. We're looking for insight from anyone who has experience with game testing to help us better Unity. Take our survey here. If chosen to participate you'll be entered into a sweepstake to win an Amazon gift card.
    Dismiss Notice
  4. On February 28th the Feedback website will shut down and be redirected to the Unity forums. See the full post for more information.
    Dismiss Notice
  5. Want to provide direct feedback to the Unity team? Join the Unity Advisory Panel.
    Dismiss Notice
  6. Unity 2018.3 is now released.
    Dismiss Notice
  7. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice

using ecs with hdrp, component group with typeof(Light) not working

Discussion in 'Entity Component System and C# Job system' started by kstothert, Feb 9, 2019.

  1. kstothert

    kstothert

    Joined:
    Dec 8, 2016
    Posts:
    19
    Code (CSharp):
    1.  lamp = GetComponentGroup(
    2. typeof(Lamp),
    3. typeof(Light)
    4. );
    when I check which light component is being referenced it's coming from UnityEngine.Light. I thought there would be a new light component in the hdrp code so i dug around but could find nothing.

    adding
    Code (CSharp):
    1. using UnityEngine.Experimental.Rendering.HDPipeline;
    does not work either
     
  2. GilCat

    GilCat

    Joined:
    Sep 21, 2013
    Posts:
    176
    I think HDRP uses UnityEngine.Light and there is no other light component anywhere.
     
  3. kstothert

    kstothert

    Joined:
    Dec 8, 2016
    Posts:
    19
    but the system does not run because the component group signature isn't matching. It has to be looking for a different Light component than the one the is attached via the GameObjectEntity.

    My intellisense is ignoring preview packages so I am unable to see where the Light component is coming from that is being referenced in the hdrp preview code. If I could just see where they are getting it from i could add that using directive
     
  4. GilCat

    GilCat

    Joined:
    Sep 21, 2013
    Posts:
    176
    I did a quick test and it finds my lamps.

    Code (CSharp):
    1. public class LightSystem : ComponentSystem {
    2.   ComponentGroup m_lightGroup;
    3.  
    4.   protected override void OnCreateManager() {
    5.     base.OnCreateManager();
    6.     m_lightGroup = GetComponentGroup(typeof(Light));
    7.   }
    8.  
    9.   protected override void OnUpdate() {
    10.     var lightCount = m_lightGroup.CalculateLength();
    11.     Debug.Log($"System is running with {lightCount} lights");
    12.   }
    13. }
    Can you show me the definition for Lamp type.
     
    kstothert likes this.
  5. kstothert

    kstothert

    Joined:
    Dec 8, 2016
    Posts:
    19
    i figured it out...I was adding the light directly to my lamp GO which included a MeshRenderer component (as did my actual componentgroup signature) when i added the light it automatically removed the mesh renderer preventing the system from running. of course it makes sense that it can't be a mesh and a light source.

    thanks for the sanity check.
     
    GilCat likes this.