Search Unity

  1. Get the latest news, tutorials and offers directly to your inbox with our newsletters. Sign up now.
    Dismiss Notice

Resolved Light created at runtime is not lighting objects.

Discussion in 'Data Oriented Technology Stack' started by BobFlame, Mar 10, 2021.

  1. BobFlame

    BobFlame

    Joined:
    Nov 12, 2018
    Posts:
    53
    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:
    53
    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:
    53
  4. thelebaron

    thelebaron

    Joined:
    Jun 2, 2013
    Posts:
    617
    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.
unityunity