Version: Unity 6 (6000.0)
Language : English
Control material properties in the Inspector window
Branching in shaders

Changing how shaders work via branching and keywords

Sometimes, you want the same shaderA program that runs on the GPU. More info
See in Glossary
to do different things under different circumstances. For example, you might want to configure different settings for different materials, define functionality for different hardware, or dynamically change the behavior of shaders at runtime. You might also want to avoid executing computationally expensive code when it’s not needed, such as texture reads, vertex inputs, interpolators, or loops.

You can use conditionals to define behavior that the GPU only executes under certain conditions.

Page Description
Shader branching Resources for using conditionals to create static and dynamic branches in shaders, and branch using built-in macros.
Shader keywords Resources and techniques for adding shader keywords, using them to create branches and shader variants, and toggling them in the Unity Editor or in a script.
Control material properties in the Inspector window
Branching in shaders