Search Unity

Question RequestShadowMapRendering() is internal

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

  1. iamarugin

    iamarugin

    Joined:
    Dec 17, 2014
    Posts:
    883
    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:
    193
    The marking of that function as internal was probably a mistake. Will make it public soon.
     
  3. iamarugin

    iamarugin

    Joined:
    Dec 17, 2014
    Posts:
    883
    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:
    883
    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.     }
     
    PutridEx and fffMalzbier like this.