Search Unity

Resolved Light created at runtime is not lighting objects.

Discussion in 'Entity Component System' started by BobFlame, Mar 10, 2021.

  1. BobFlame

    BobFlame

    Joined:
    Nov 12, 2018
    Posts:
    95
    Hi, I'm using Hybrid Renderer 0.11.0 and URP 10.3.2 in 2020.2.7.

    There is a problem when I instantiate prefab entity with light components: the instantiated light is not lighting the instantiated mesh.

    If I create a new gameobject in editor in playmode, it could be lit though.

    If not using URP, light is working correctly.

    I don't know it's a URP problem or Hybrid Renderer problem. Hope someone could help me?

    This is prefab conversion code:
    Code (CSharp):
    1.  
    2.     /// <summary>  </summary>
    3.     public class LightEffectAuthoring : AtomEffectAuthoring, IConvertGameObjectToEntity
    4.     {
    5.         public void Convert(Entity entity, EntityManager dstManager, GameObjectConversionSystem conversionSystem)
    6.         {
    7.             var light = GetComponent<Light>();
    8.             conversionSystem.AddHybridComponent(light);
    9.             dstManager.AddComponentData(entity, new EffectControlledBy { });
    10.             dstManager.AddComponentData(entity, new LightController { });
    11.             dstManager.AddComponentData(entity, new LightEffect { });
    12.         }
    13.     }
     
    Last edited: Mar 10, 2021
  2. BobFlame

    BobFlame

    Joined:
    Nov 12, 2018
    Posts:
    95
    The problem only exists in Hybrid_Renderer_V2, so it should be a specific problem related with hybrid renderer, not URP.
     
  3. BobFlame

    BobFlame

    Joined:
    Nov 12, 2018
    Posts:
    95
  4. thelebaron

    thelebaron

    Joined:
    Jun 2, 2013
    Posts:
    855
    Hybridv2 has not supported point lights since forever(been waiting for probably a year now? But after reading Jussi's answer, I tried out the current master branch of the universal package(and also subsidiary packages, core, vfxgraph and shadergraph).

    I can happily report that point lights and shadows are working flawlessly in deferred now and it was basically a drop in replacement and just switching a dropdown menu from forward to deferred in the what was previously called the ForwardRenderData asset of your universal pipeline settings file.

    If you are impatient like me, its worth a try as it feels very solid. Otherwise I am unsure when it will be released officially as a package, but it appears as if its just around the corner(at least in terms of dots timeframes).

    (Note this is also using the current latest alpha editor release, which I assume the universal requires)
     
    charleshendry likes this.
  5. Krooq

    Krooq

    Joined:
    Jan 30, 2013
    Posts:
    194
    It appears that this is still the case?
    Can you confirm which versions of things you are using?

    I assume its at least Unity version 2021 to get the latest URP so sounds like a 0.51 thing (hopefully)
     
  6. thelebaron

    thelebaron

    Joined:
    Jun 2, 2013
    Posts:
    855
    @krooq Sadly this was using a beta(could've been an alpha) version of 2021, and something in a later editor release broke compatibility with the prior entities package. I downgraded to 2020 like most others after a bunch of hemming and hawing.
    Unfortunately its been just a directional light for me ever since, practically the stone ages of graphics ;)
     
    Harry-Wells and Krooq like this.