Search Unity

Bug Shader graph not working correctly on build, but looks correct when playing in editor

Discussion in 'Shader Graph' started by ez9002, Aug 25, 2021.

  1. ez9002

    ez9002

    Joined:
    Mar 21, 2019
    Posts:
    7
    Hello, I have a simple shader graph that attempts to get an object's position, and then randomize the color of the object based on this position. When I preview this in the Unity editor, it works just fine. When I build my game and run it on the Oculus Quest 2, all of the objects are the exact same color, rather than a randomly selected color. Also, I'm using the URP for this project, if that is important or could be impacting things. I feel like this has to be a bug but I could be doing something wrong on my end.

    Can anyone point me in the right direction on this? I've attached my shader graph below. I'm at a complete loss for how to proceed with this issue.

    Screen Shot 2021-08-25 at 11.23.06 AM.png
     
  2. ez9002

    ez9002

    Joined:
    Mar 21, 2019
    Posts:
    7
    I hate to bump this but this issue is seriously halting development. We've got a ton of materials we need to color on a per-instance basis but we cannot test our builds accurately with the current issue persisting. Would appreciate some help!
     
  3. _geo__

    _geo__

    Joined:
    Feb 26, 2014
    Posts:
    1,336
    Maybe you have set your precision to "half". If yes then try to increase it. There is an option to show it in the graph. I once had the problem of position based random colors not working due to too greedy precision optimization by me. It worked fine in the editor but failed on (some) mobile devices.
     
  4. ez9002

    ez9002

    Joined:
    Mar 21, 2019
    Posts:
    7
    I haven't set my precision to half, that was actually the first thing I tried. I appreciate the suggestion though.
    I am still running into this issue, although I suppose a valid workaround would be if anyone knew an effective way of tinting the color of different objects different colors while they all share a material?
     
  5. _geo__

    _geo__

    Joined:
    Feb 26, 2014
    Posts:
    1,336