Many Unity Shader developers often get confused about the differences between
shader_feature
and multi_compile
, and when to use each one. I’ve encountered similar confusion myself, so I’ve put together this comparison table and practical guide to help everyone quickly understand the correct usage.
Keyword Type | Variant Depends on Material | Global Scope | Material Keyword State Saved | Runtime Dynamic Switch | Typical Usage |
---|---|---|---|---|---|
shader_feature | ✔️ (Yes) | ✔️ (Global) | ✔️ | ❌ | Static config, lean build |
shader_feature_local | ✔️ (Yes) | ❌ (Local) | ✔️ | ❌ | Static config, lean build |
multi_compile | ❌ (No) | ✔️ (Global) | ❌ | ✔️ | Runtime switching |
multi_compile_local | ❌ (No) | ❌ (Local) | ❌ | ✔️ | Runtime switching |
沒有留言:
張貼留言