Search Unity

Question Sprites with custom shader hide text/UI elements?

Discussion in 'Shader Graph' started by FredisonP, Mar 5, 2021.

  1. FredisonP

    FredisonP

    Joined:
    Jun 28, 2020
    Posts:
    1
    Hi,

    I'm making a 2D game primarily composed of sprites using a simple 8-color palette, and I want the player to be able to customize the colors in that palette. I ended up following a tutorial and messing around with the Shader Graph to make a custom material/shader, resulting in this:

    https://i.imgur.com/3cdVrNJ.png

    The shader mostly works as intended, with one problem: Now every sprite using my custom material/shader obscures all UI elements, regardless of the layer/display layer the canvas is on. Also, setting that material on UI images doesn't seem to do anything. I wasn't planning on using a lot of UI images in the first place, but I did want to display a lot of text.

    I'm mostly new to using shaders in Unity, so I'm a bit clueless about them still. What am I doing wrong?
     
  2. Apocryphus

    Apocryphus

    Joined:
    Apr 13, 2014
    Posts:
    1
    You may have moved past this, but in case anyone else ends up here, what sorted this out for me was changing the Plane Distance on my Canvas to a much lower number than the default 100. Setting it to '1' seemed to resolve this for me. Not sure if I'll run into other problems yet, but wanted to drop this note to any others with the issue before I forgot.

    Edit: I was having this problem with a canvas set to Camera Space, which is why I have the Plane distance option.