Search Unity

UI Image Shaders (Transparency Not working)

Discussion in 'Shaders' started by FirstTimeCreator, Sep 14, 2018.

  1. FirstTimeCreator

    FirstTimeCreator

    Joined:
    Sep 28, 2016
    Posts:
    768
    Hello,

    I am needing a little help with an issue. I am trying to make a UI image transparent with a custom shader which should be rather simple, It appears to work correctly in the editor view but not in game.

    All I get is a solid color and no transparency or refraction. The alpha channel on opacity mask is working.

    I am using Amplify Shader Editor.

    My canvas is screen space overlay, I have tried moving to screen space camera with no effect.

    It appears to be an issue with surface shader, unlit sprite shader gives me transparency but I am trying to add FX.

    I don't have any experience outside of surface shaders, so with that said can someone point me in the right direction as to why surface shaders don't work correctly on canvas images?

    Thanks
     
  2. FirstTimeCreator

    FirstTimeCreator

    Joined:
    Sep 28, 2016
    Posts:
    768
    nevermind on this i figured it out. ;)
     
  3. FirstTimeCreator

    FirstTimeCreator

    Joined:
    Sep 28, 2016
    Posts:
    768
    Nevermind apparently I didn't. I'm able to get it to work in editor scene / game but does not work in build.
     
  4. telica77

    telica77

    Joined:
    Aug 27, 2017
    Posts:
    6
    My issue might be related. I upgraded from 2018.2.19 to 2019.1, now alpha doesn't work on my UI images that are on an overlay canvas. In play mode I can adjust the alpha from 0 to 255 and it won't affect the UI image at all, however if i make the image a parent of a different object (not the overlay canvas) then the transparency works all of sudden. This makes me think something has changed with overlay canvas, but I have no idea what or how to fix it. Any help appreciated.
     
  5. E-Fir

    E-Fir

    Joined:
    Jun 26, 2019
    Posts:
    2
    I have faced a similar issue.
    Adding
    Code (CSharp):
    1. Tags{ "Queue" = "Transparent" "RenderType" = "Transparent" }
    2. Blend SrcAlpha OneMinusSrcAlpha
    3.  
    to my shader is solved my problem.