Search Unity

Shadows not show on mobile devices

Discussion in 'Universal Render Pipeline' started by MateAndor, Jan 29, 2020.

  1. MateAndor

    MateAndor

    Joined:
    Nov 5, 2014
    Posts:
    70
    Hello guys!

    I created a mobile game and I use directional light with shadows. On the editor everything works good but when I create a mobile build (Android or IOS) the shadows not visible.
    I try to add graphics setting to switch between the quality setting but did not help.

    why is that?
     
  2. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,411
    is your quality settings same for all platforms? are you using default materials/shaders?
     
  3. aleksandrk

    aleksandrk

    Unity Technologies

    Joined:
    Jul 3, 2017
    Posts:
    3,014
    Also, which Unity version are you using?
    Builtin render pipe or Lightweight/Universal or something else?
     
  4. MateAndor

    MateAndor

    Joined:
    Nov 5, 2014
    Posts:
    70
    I tried with Unity 2018.4,15f1 and 2019.3.0f6 too.
    - Shaders: LWRP/LIT with receive shadows on.
    - Lightmap: Baked
    - 1 Directional Light on Mixed mode.

    The quality settings are the same on all the platforms but the shadows handled by the Scriptable Render Pipeline settings what I change from code.

    Code (CSharp):
    1. public RenderPipelineAsset lowQuality;
    2. public RenderPipelineAsset mediumQuality;
    3. public RenderPipelineAsset highQuality;
    4.  
    5. public void SetQuality(int _quality)
    6. {
    7.         switch (_quality)
    8.         {
    9.             case 0:
    10.                 GraphicsSettings.renderPipelineAsset = lowQuality;
    11.                 QualitySettings.SetQualityLevel(1, true);
    12.                 break;
    13.             case 1:
    14.                 GraphicsSettings.renderPipelineAsset = mediumQuality;
    15.                 QualitySettings.SetQualityLevel(3, true);
    16.                 break;
    17.             case 2:
    18.                 GraphicsSettings.renderPipelineAsset = highQuality;
    19.                 QualitySettings.SetQualityLevel(5, true);
    20.                 break;
    21.         }
    22. }
    In editor everything is okay...
     
  5. Tim-C

    Tim-C

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    2,225
    When you build the player do you have an SRP assigned in the Graphics settings? It uses this to figure out what should be stripped so if there is none there it might strip the shaders you intend to use. We have this being tested in our automation so we kknow shadows work on players.

    If this is set up properly can you log a bug as we have not seen this.
     
  6. MateAndor

    MateAndor

    Joined:
    Nov 5, 2014
    Posts:
    70
    HAHA!

    I changed the SRP to the highest on Graphics settings and after that, I build ... and voila!
    Thanks for the tip! Now I can change the quality of my game!