Search Unity

  1. We are migrating the Unity Forums to Unity Discussions. On July 12, the Unity Forums will become read-only. On July 15, Unity Discussions will become read-only until July 18, when the new design and the migrated forum contents will go live. Read our full announcement for more information and let us know if you have any questions.

Question Sprite lit shaders are going black after exporting to android

Discussion in '2D' started by Infinity-Doole, Apr 26, 2024.

  1. Infinity-Doole

    Infinity-Doole

    Joined:
    Mar 11, 2022
    Posts:
    5
    Hello, I am making a 2d unity game and everything works fine in the editor and game view. But when I export it for android and open it on my phone through google play all the sprites turn black (The water doesn’t because it is unlit). Is there a setting in player settings or something like that?

    Here are some screen shots (sorry it only lets me post one screen shot):



     
  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    39,571
    Check the device logs to see if you're getting any shader errors.

    If not then review your sprite sorting layer and sorting order values.

    If any are the same then which is in front is luck of the draw, so make them different.

    More reading:

    Three (3) primary ways that Unity draws / stacks / sorts / layers / overlays stuff:

    https://forum.unity.com/threads/orthographic-camera-rendering-order.1114078/#post-7167037

    In short, as far as the Standard Rendering Pipeline,

    1. The default 3D Renderers draw stuff according to Z depth - distance from camera.

    2. SpriteRenderers draw according to their Sorting Layer and Sorting Depth properties

    3. UI Canvas Renderers draw in linear transform sequence, like a stack of papers

    If you find that you need to mix and match items using these different ways of rendering, and have them appear in ways they are not initially designed for, you need to:

    - identify what you are using
    - search online for the combination of things you are doing and how to to achieve what you want.

    There may be more than one solution to try.

    For instance, you may even use multiple co-located cameras to more-explicitly control apparent draw ordering.

    Additional reading in the official docs:

    https://docs.unity3d.com/Manual/2DSorting.html

    And SortingGroups can also be extremely helpful in certain circumstances:

    https://docs.unity3d.com/Manual/class-SortingGroup.html

    Other rendering pipelines may have other ways of layering (HDRP and URP). Go see the latest docs for details.

    There's lots of third party open source packages available as well, such as this:

    https://github.com/mob-sakai/ParticleEffectForUGUI
     
  3. Infinity-Doole

    Infinity-Doole

    Joined:
    Mar 11, 2022
    Posts:
    5
    I will check it out thank you so much
     
  4. Infinity-Doole

    Infinity-Doole

    Joined:
    Mar 11, 2022
    Posts:
    5
    So I used a log cat and this is all I am getting from unity. Is anything here bad or stopping the lighting? Also can I be hack if I post this?
    05-06 15:54:46.490 23208 23227 I Unity : MemoryManager: Using 'Dynamic Heap' Allocator.
    05-06 15:54:46.510 23208 23227 I Unity : SystemInfo CPU = ARM64 FP ASIMD AES, Cores = 8, Memory = 7477mb
    05-06 15:54:46.510 23208 23227 I Unity : SystemInfo ARM big.LITTLE configuration: 4 big (mask: 0xf0), 4 little (mask: 0xf)
    05-06 15:54:46.510 23208 23227 I Unity : ApplicationInfo com.doodleco.fancyfishing version 5.5
    05-06 15:54:46.510 23208 23227 I Unity : Built from '2022.3/staging' branch, Version '2022.3.7f1 (b16b3b16c7a0)', Build type 'Release', Scripting Backend 'il2cpp', CPU 'arm64-v8a', Stripping 'Enabled'
    05-06 15:54:46.664 23208 23227 I Unity : Company Name: Doodle Co
    05-06 15:54:46.664 23208 23227 I Unity : Product Name: Fancy Fishing
     
  5. Infinity-Doole

    Infinity-Doole

    Joined:
    Mar 11, 2022
    Posts:
    5
    I have narrowed it down to the urp asset. (I make another project and did the bare minim to get it to have light and it has the same problem)
     
  6. pertholdth

    pertholdth

    Joined:
    Feb 28, 2024
    Posts:
    227
    maybe try using the 2d renderer pipeline
     
  7. Infinity-Doole

    Infinity-Doole

    Joined:
    Mar 11, 2022
    Posts:
    5
    I fixed it... but I don't know how. :(
     
    JBornstein90 likes this.