Search Unity

  1. Looking for a job or to hire someone for a project? Check out the re-opened job forums.
    Dismiss Notice
  2. Unity 2020.2 has been released.
    Dismiss Notice
  3. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

Help Wanted RequestShadowMapRendering() is internal

Discussion in 'High Definition Render Pipeline' started by iamarugin, Oct 22, 2019.

  1. iamarugin

    iamarugin

    Joined:
    Dec 17, 2014
    Posts:
    570
    Quote from docs:

    On Demand HDRP updates the shadow maps for the light every time you request them. To do this, call the RequestShadowMapRendering() method in the Light's HDAdditionalLightData component.

    But this method marked as internal that means it is not available from game code. So how to request shadow maps update in this case?
     
  2. francescoc_unity

    francescoc_unity

    Unity Technologies

    Joined:
    Sep 19, 2018
    Posts:
    34
    The marking of that function as internal was probably a mistake. Will make it public soon.
     
  3. iamarugin

    iamarugin

    Joined:
    Dec 17, 2014
    Posts:
    570
    Thanks!
     
  4. MohsenneChaverdie

    MohsenneChaverdie

    Joined:
    Nov 23, 2016
    Posts:
    39
    As of 7.1.2. is marked as Internal.
     
  5. iamarugin

    iamarugin

    Joined:
    Dec 17, 2014
    Posts:
    570
    It will be available in 7.1.3
     
  6. MohsenneChaverdie

    MohsenneChaverdie

    Joined:
    Nov 23, 2016
    Posts:
    39
    Until then it can be called by using reflection:

    - Just add the static class to the solution.

    Code (CSharp):
    1.  public static class ShadowMapWorkaround
    2.     {
    3.         private static readonly MethodInfo MethodInfo = typeof(HDAdditionalLightData).GetMethod(
    4.             "RequestShadowMapRendering",
    5.             BindingFlags.Instance | BindingFlags.NonPublic);
    6.  
    7.         public static void RequestShadowMapRendering(this HDAdditionalLightData data)
    8.         {
    9.             MethodInfo.Invoke(data, null);
    10.         }
    11.     }
     
    fffMalzbier likes this.
unityunity