Search Unity

  1. The 2022.1 beta is now available for testing. To find out what's new, have a look at our 2022.1 beta blog post.
    Dismiss Notice

Help Wanted Make an object fade out when triggered?

Discussion in 'Shader Graph' started by AlphabeticalNugget, Dec 3, 2021.

  1. AlphabeticalNugget

    AlphabeticalNugget

    Joined:
    Apr 29, 2016
    Posts:
    1
    Hi! I used Brackey's tutorial
    on how to make a dissolve effect with shader graph and I'm trying to make it where when I shoot an object with a gun, I want it to trigger the shader and dissolve the object and eventually destroying it.

    My problem is, this technique in the shader graph creates a constant loop, how do I make it to where it starts at 100% opacity, and then when triggered, dissolves and doesn't come back? Or at least have it reset back to the beginning instead of fading back and forth.

    Thanks!
     
  2. Qriva

    Qriva

    Joined:
    Jun 30, 2019
    Posts:
    323
    Instead of using Sine Time just use custom exposed property for example "dissolve" (values 0-1) and then you can change it manually in material. If you want to animate it then you need script or animation to control the exposed property in the way you want.
    The other way is to expose something like startTime and subtract it from current time, plus clamp it between 0 and 1 - this way you just set startTime (with Time.time) and it will animate once from that moment.
     
unityunity