Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Black Sprites sometimes when running.

Discussion in '2D' started by WinterSoldier5, Sep 4, 2015.

  1. WinterSoldier5

    WinterSoldier5

    Joined:
    Jul 24, 2015
    Posts:
    13
    Hi,

    I've made a 2D game for android but I'm finding that sometimes when I run the app and some of my sprites will be black. I'm testing on 3 different android phones and one tablet and the issue is sporadic but has been seen on all of them. I'm also running google Admobs within the game for advertising and even they show up as black.

    I use a total of 6 sprite sheets, all set to exactly 1024x1024 and the total file size of my sprites folder is 1.77MB. I have texture compression set to ETC1 or RGBA16 on my build settings and building for android 2.3.1 and the issue really is sporadic. I am using no custom shaders, purely Unity's defaults and have also tried disabling the 32 bit display buffer but still no luck.

    Sometimes the game will load absolutely fine and other times it loads with the majority of my sprites black and I'm really lost for why this is happening. I've added a screenshot with this too in the hopes that somebody can shed some light on this issue.

    Thanks in advance for any help.
     

    Attached Files:

  2. WinterSoldier5

    WinterSoldier5

    Joined:
    Jul 24, 2015
    Posts:
    13
    Anybody have any ideas please? I'm really at a loss and this is the only thing holding me back from release.
     
  3. Llufes

    Llufes

    Joined:
    Jan 16, 2015
    Posts:
    6
    Hi WinterSoldier5,
    I am facing the same exact problem here. One day, for no reason, some sprites started to appear as black shapes.

    This is not happening all the time with all the textures, but sometimes ones are black, other times I get different ones and so on.

    Did you manage to find a fix? If so, how did you do it? If not, we can try to find a solution together.

    My textures are 2048 and this should be fine (I am building for Android)

    Kind Regards
     
  4. WinterSoldier5

    WinterSoldier5

    Joined:
    Jul 24, 2015
    Posts:
    13
    Hi Llufes,

    Unfortunately I am yet to find a fix for this, however, as you say we may find a solution together and so I'll give you as much information as I can. So the most important information I've found is from the logcat from Adb. I ran the game multiple times and tried to repeat the issue, I found that when the issue is missing the following line is present in the logcat which looks rather ominous.

    E/Unity (23092): GLSL compilation failed, no infolog provided


    So here's also what I've tried without fixing it:

    Disable Anti Aliasing
    Using ETC1 / RGBA16 Compression
    Making Textures smaller than 1024x1024
    Recreating the project from scratch
    Upgrading to the latest version of Unity
    Set quality settings to fastest
    Disabled 32 bit buffer
    Disabled Mipmaps for sprites

    None of these have solved the issue and it has got to the point now where I had to submit a bug report through Unity as I just don't know the answer.

    Hopefully you have better luck than I do.
     
    Last edited: Sep 15, 2015
  5. Llufes

    Llufes

    Joined:
    Jan 16, 2015
    Posts:
    6
    Hi again WinterSoldier5,

    Tonight I will work on it, I will try to change everything that could be affecting it. It is interesting though that a friend of mine could run the project on another device, different from mine without the black sprites.

    We stay in touch.
     
  6. WinterSoldier5

    WinterSoldier5

    Joined:
    Jul 24, 2015
    Posts:
    13
    Be aware this may not be quite as you think. The issue for me is very random and will appear fine most of the time and then just one or two times it isn't. I'm testing on 3 different devices myself and have seen it on all of them at some point with varying levels of how common it is.
     
  7. leoyaik

    leoyaik

    Joined:
    Oct 13, 2014
    Posts:
    6
    Hi

    Can you provide us with

    1. The specs or model of the devices you are testing your game on?
    2. A sample project to help us reproduce this problem (via bug reporter)

    We will take a look at our end to see what might be the problem.

    Cheers
     
  8. WinterSoldier5

    WinterSoldier5

    Joined:
    Jul 24, 2015
    Posts:
    13
  9. Leo-Yaik

    Leo-Yaik

    Unity Technologies

    Joined:
    Aug 13, 2014
    Posts:
    434
    @WinterSoldier5 I am moving this thread to the Graphics forum to get more views on it.
     
  10. Waqas-Anwar

    Waqas-Anwar

    Joined:
    Feb 2, 2015
    Posts:
    26
    Any solution for this issue ?
    Some of my RGBA 16 bit sprites and TextMeshes are facing this issue.
     
  11. Kurius

    Kurius

    Joined:
    Sep 29, 2013
    Posts:
    412
    In SOME cases this can be due to certain phones not being able to process NPOT (not power of two) textures. In other words, textures that have certain odd pixel dimensions. Specifically the safest (but not practical) thing to do is to make sure that all of your sprites are a POT (power of two), such as 8px by 8px, 32px by 128px, etc. It's ok to increase transparent space around a PNG in order to achieve the nearest POT value. For example if you have a sprite that is 100px by 400px, just add extra transparent space around it so that the final PNG is 128px by 512px.