Search Unity

Bug Weird behavior with few PNGs in unity. Transparency is disturbed.

Discussion in 'Formats & External Tools' started by WaqasGameDev, Feb 4, 2021.

  1. WaqasGameDev

    WaqasGameDev

    Joined:
    Apr 17, 2020
    Posts:
    118
    Hi, this happens to me many times when I import images into unity with transparency. As you can see, In preview window, still there is transparency but when I drag the image into scene, its all disturbed. What could be the issue?
     
  2. WaqasGameDev

    WaqasGameDev

    Joined:
    Apr 17, 2020
    Posts:
    118
    Here is the image
     

    Attached Files:

  3. fffMalzbier

    fffMalzbier

    Joined:
    Jun 14, 2011
    Posts:
    3,276
    Look like in the scene the whole mesh is drawn might be worth checking the material that is used to render the image.
     
  4. npatch

    npatch

    Joined:
    Jun 26, 2015
    Posts:
    247
    Apart from the material, I'd also check the import settings, but just below the part you are showing us. There's an advanced foldout. Make sure that Alpha Source is set to Input Texture Alpha and also check Alpha is Transparency(although at least for Sprite Renderer with the Sprite-Default material, this doesn't seem to matter).
     
  5. WaqasGameDev

    WaqasGameDev

    Joined:
    Apr 17, 2020
    Posts:
    118
    upload_2021-3-4_19-47-33.png

    I even tried with custom material but still the behavior was same.

    Alpha is already marked as transparency. Please refer to original post of mine where I also showed the PREVIEW of the image where there you can see alpha channel in preview as well.

    More clarification is that the same sprites are shown correctly at higher resolutions but when I reduce resolution of the image i.e. by reducing max size of the image, this issue occurs and transparency is disturbed.
     
  6. npatch

    npatch

    Joined:
    Jun 26, 2015
    Posts:
    247
    You're right. Question, first Unity version is this?
    Also for what it's worth, took an 8K png and set max res to 32x32 and 3px to unit. And applied a ridiculously small scale to it and it was fine on 2019.4.20.
    On the other hand, I see ETC2, so I'm guessing you're building for Android. Perhaps it's an issue with ETC2?
     
    Last edited: Mar 4, 2021