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. Dismiss Notice

Bug Gradient resetting almost everytime I try to do something in my ShaderGraph

Discussion in 'Shader Graph' started by CorneliaRapp, Sep 3, 2020.

  1. CorneliaRapp

    CorneliaRapp

    Joined:
    Jan 29, 2020
    Posts:
    1
    I sample from two gradients, one for alpha and one for color, and the gradient goes back to solid white every time I switch back to the window, so everytime I want to save the Shadergraph, I need to manually set the two gradients to the correct gradient preset again. It is quite annoying...
     
  2. Shaunyowns

    Shaunyowns

    Unity Technologies

    Joined:
    Nov 4, 2019
    Posts:
    328
    Hey there, are you able to elaborate on this and provide us more information on the version of Unity you're using it'll help us a ton!
     
  3. KYL3R

    KYL3R

    Joined:
    Nov 16, 2012
    Posts:
    128
    This happens to me as well once in a while. Gradient nodes are wiped (all white or all black). Restarting Unity, Re-opening Shadergraph etc. works fine - I don't know when it happens but I will keep an eye on it.
     
  4. Antypodish

    Antypodish

    Joined:
    Apr 29, 2014
    Posts:
    10,580
    @Shaunyowns
    It happens to me too.
    Most of the time I noticed, when using undo (ctrl+z). Btw. undo is very slow shader graph.
    There were some probably other cases, but unable to recall them. Or maybe were indeed ctrl+z..
    Issue is present 9.0 preview 55. Uncertain if it was as well 8.2, but I think it was too.
    Using Unity 2020.3.1f1. But also was issue present in 2020.2.

    I lost gradient property multiple times, in different shaders. Had to set colors again.
    Sometimes is hard to notice, when focusing on different part of the graph (zoomed).

    I am not sure, if that may even apply to cross multiple open Shaders, but haven't tested. Had some impression. Just need keep an eye on it.

    For now, I add note above each gradient node and create templates in HDR Gardient Editor. Is a bit annoying but works for time being.

    To replicate
    • Create New shader graph in my case Unlit Shader Graph
    upload_2020-10-30_1-28-24.png
    • Create some nodes
    upload_2020-10-30_1-28-57.png

    • Populate Gradient with anything

    upload_2020-10-30_1-30-22.png
    • Add some more nodes. (You can skip this step).
    • Save shader
    • Close shader
    • Reopen Shader
    • Add one more node.
    • Ctr+Z few times.
    • Now Gradient should become white.
    In my case, I can replicate it every time.
     
  5. Antypodish

    Antypodish

    Joined:
    Apr 29, 2014
    Posts:
    10,580
    @Shaunyowns I do wonder, was this issue addressed and replicated?
     
  6. plant_machine

    plant_machine

    Joined:
    Nov 13, 2020
    Posts:
    2
    I'm still experiencing it, with Unity 2020.1.6f1. Undoing while in shader graph resets the gradients to blank white.
     
  7. UnityMaru

    UnityMaru

    Community Engagement Manager Unity Technologies

    Joined:
    Mar 16, 2016
    Posts:
    1,227
  8. stor314

    stor314

    Joined:
    Apr 26, 2019
    Posts:
    20
    Anyone who comes upon this in the future, i was running into this issue on 2020.1.7, my gradient node in shader graph was never being saved and i had to reload the shadergraph everytime for it to appear in the editor. the more pressing problem though was no matter what i tried the gradient would never show up in the build either.

    Luckily, I updated to 2021.1.6 and this issue was fixed
     
  9. Steamc0re

    Steamc0re

    Joined:
    Nov 24, 2014
    Posts:
    144
    Submitted a bug for 2020.3.8f1 where I'm still experiencing this.
     
  10. wannaMakeAGame

    wannaMakeAGame

    Joined:
    Dec 7, 2020
    Posts:
    47
    In 2021.1.1f, it still happens
     
  11. Twilight_18

    Twilight_18

    Joined:
    Feb 23, 2020
    Posts:
    3
    Happens to me too every time I boot up Unity
     
  12. Twilight_18

    Twilight_18

    Joined:
    Feb 23, 2020
    Posts:
    3
    Actually I found a fix (I think). If you put a gradient as a variable and then assign your gradient (rather than using the gradient node), it won't reset for me like it used to. Notice on the upper righthand side I added a new gradient variable and replaced the gradient node with it. If this doesn't work out for you, I would write a quick script that references the gradient variable (using SetColor("Gradient_bb19e34b3d14465a9013cbae3c6339cc") in my case) and set it to whatever gradient you want in a Start function.
    old.PNG new.PNG
     
  13. LandonTownsend

    LandonTownsend

    Unity Technologies

    Joined:
    Aug 21, 2019
    Posts:
    35
    Our QA is struggling to reproduce this bug. Would you mind posting videos of any steps you've found to reliably reproduce this bug? This could be being caused by some factor we have not figured out yet and videos of the repro steps may help us narrow this down.
     
  14. Antypodish

    Antypodish

    Joined:
    Apr 29, 2014
    Posts:
    10,580
    Can they not reproduce from my post above?
    #4

    Btw. I tried now:
    Unity 2021.1.6f1
    Shader Sraph 11.0.0
    And HDR scene, with lit graph.
    I can not reproduce bug anymore.
    Maybe is fixed?
     
    Last edited: Jul 26, 2021
  15. LandonTownsend

    LandonTownsend

    Unity Technologies

    Joined:
    Aug 21, 2019
    Posts:
    35
    These are the exact steps I followed
    1. Use a fresh project with 2020.3.1f1 with URP 10.3.2 installed and a Universal Render Pipeline Asset set as the current pipeline asset
    2. Right Click -> Create -> Shader -> Universal Render Pipeline -> Unlit Shader Graph
    3. Double click to open shader graph
    4. Create a color node on the graph, edit the color and set it to pink
    5. Create a boolean node on the graph
    6. Create a Gradient node
    7. Edit the Gradient, add a new color to the center of it, set the color to red
    8. Create a Sample Gradient node
    9. Plug the Gradient node into the Sample Gradient node
    10. Plug the Sample Gradient node into base color
    11. Save the graph
    12. Close the graph
    13. Open the graph again
    14. Add an "add" node to the graph
    15. Undo 10 times
    This is what my graph looked like after (see attached image)

    As you can see, the gradient did not reset to white.
    Can you repeat your steps in a fresh project in 2020.3.1f1 and let me know if it still reproduces?
     

    Attached Files:

  16. Steamc0re

    Steamc0re

    Joined:
    Nov 24, 2014
    Posts:
    144
    @Antypodish are you using git?
    @LandonTownsend I cannot reliably reproduce it in a new project either. But, it is randomly occurring consistently in my current project. I don't know why or when it will happen, but at a certain point, opening the shadergraph on my complex shader with gradient will show white gradients. However, something to note is that the actual values in the gradients that are not properties are correct in all materials that use that shader. As long as you don't save it when it occurs, the materials that use that shader will still have the correct gradients (again even though the gradient isn't exposed).
    @Twilight_18 Trying out your fix. Isn't it annoying AF we can't expose gradients? I
     
    Last edited: Jul 30, 2021
  17. Antypodish

    Antypodish

    Joined:
    Apr 29, 2014
    Posts:
    10,580
    Yes. Why asking? Is that relevant to subject?
     
  18. Steamc0re

    Steamc0re

    Joined:
    Nov 24, 2014
    Posts:
    144
    It might be - I think I have narrowed down the guaranteed reset to switching branches. But I am so friggin' busy I don't have the time to wrestle with the actual work on my project and restoring lost gradients after testing git actions.
     
  19. Steamc0re

    Steamc0re

    Joined:
    Nov 24, 2014
    Posts:
    144
    @LandonTownsend Try converting a few nodes with a gradient into a subgraph. Repro 100% in 2020.3.16f1
     
  20. lrasomattos

    lrasomattos

    Joined:
    Aug 22, 2015
    Posts:
    29
    Having a similar issue on 2022.1.0b4
    I know 2022 is in beta, but seems like the exact same problem. When using Gradient node (instead of just Sample Gradient with attached gradient), the Gradient node resets. I couldn't figure it out exactly when, but felt like it happened when updating the Plastic SCM branch. Or at some other points when recompiling the shader (like just saving the graph).
    I'll test using the Gradient as variables as a workaround.
     
  21. diogovaladaresxdlol

    diogovaladaresxdlol

    Joined:
    Jul 17, 2021
    Posts:
    2
    I'm also having this problem, I had it in 2019,2020 and 2021.1.25f1, its pretty annoying
     
    Sid1719 likes this.
  22. gvx

    gvx

    Joined:
    Dec 24, 2018
    Posts:
    3
    This bug is still going strong in 2022.1.15f1. Very annoying.
     
  23. dublduch_unity

    dublduch_unity

    Joined:
    Feb 3, 2019
    Posts:
    1
    Absolutely the same problem on 2021.2.11f1
     
  24. Chitchou

    Chitchou

    Joined:
    Dec 24, 2022
    Posts:
    2
    same in the last version 2021.3.16f1
     
    Last edited: Jan 8, 2023
  25. Rafael-cmk

    Rafael-cmk

    Joined:
    Jun 28, 2016
    Posts:
    55
    Unity version 2021.3.23f1, the problem still exists.