Hi
I have a switch in a shader which works when I use it in the inspector but if I try to animate it (using 0 for off and 1 for on) then it doesn't work, am I doing something wrong?
I'm using the Unity animator and keyframing the states.
Thanks
Animating a switch on and off
Re: Animating a switch on and off
I've got this working now, I've now used a toggle switch instead of a static switch and the toggle works fine when animated. Not sure why the static switch doesn't animate.
- Amplify_Borba
- Posts: 1239
- Joined: Mon Jul 24, 2017 9:50 am
Re: Animating a switch on and off
Hello, thank you for getting in touch and for your support!
In order to allow the shader to be changed in runtime through the Static Switch node, you likely need to set its Keyword Type property to Multi Compile, as it will generate all shader variants and include them all in the build. The Shader Feature type will only generate the used variants, and will only include in the build the active one, making it extremely efficient.
To clarify, the general purpose of the Static Switch node is to allow for the generation of a number of shader variants, which are generated internally by Unity depending on the type of Keyword that you're using.
In short, Toggles are comparable to Lerp nodes, as they execute all calculations, while Static Switches can execute only what you define.
In order to allow the shader to be changed in runtime through the Static Switch node, you likely need to set its Keyword Type property to Multi Compile, as it will generate all shader variants and include them all in the build. The Shader Feature type will only generate the used variants, and will only include in the build the active one, making it extremely efficient.
To clarify, the general purpose of the Static Switch node is to allow for the generation of a number of shader variants, which are generated internally by Unity depending on the type of Keyword that you're using.
In short, Toggles are comparable to Lerp nodes, as they execute all calculations, while Static Switches can execute only what you define.
Customer Relations at Amplify Creations
Learn more about our offering: Amplify Creations Products
Amplify Shader Editor won the Asset Store Best Tool Award - Thank you for your support!
Learn more about our offering: Amplify Creations Products
Amplify Shader Editor won the Asset Store Best Tool Award - Thank you for your support!
Re: Animating a switch on and off
Thanks very much, I understand now.
- Amplify_Borba
- Posts: 1239
- Joined: Mon Jul 24, 2017 9:50 am
Re: Animating a switch on and off
Happy to help, please let us know if you come across any further questions, thanks!
Customer Relations at Amplify Creations
Learn more about our offering: Amplify Creations Products
Amplify Shader Editor won the Asset Store Best Tool Award - Thank you for your support!
Learn more about our offering: Amplify Creations Products
Amplify Shader Editor won the Asset Store Best Tool Award - Thank you for your support!