# How to Enable/Disable Effects at Runtime

**There are 2 ways of achieving this:**

1. All effects have a property value combination that makes them look deactivated (usually by reducing the amount or blend property to 0, but it may vary depending on the effect). So the most clean way of deactivating and activating effects is by enabling all the effects you’ll use and then dynamically changing the property values either by animating the properties or by modifying the values by script as seen in the Scripting section.
2. This other way is less efficient, messier and will cause materials to become invisible in the final build if you set a combination of effects that isn’t included in some other material in your project. So be warned, use this with caution (in fact you should probably avoid this option and use option 1 instead) and test it on the target platform. If material effects disappear or you get a graphics error (object turns pink) at some point make sure to have some material in your project that includes the same set of effects than the material that isn’t showing.

This method consists on enabling and disabling the shader compilation flags at runtime, so Unity will compile and replace the shader at runtime (on a final build shaders can’t be compiled, so a shader variant with the new keywords will need to be available to avoid the errors mentioned). If you are sure to have a shader variant for the resulting toggle combination you can use the Enable/Disable Keyword method like so:

```
Material mat = GetComponent<Renderer>().material;
…
mat.EnableKeyword("GLOW_ON");
mat.DisableKeyword("GLOW_ON");

```

(Keyword names of every effect can be found at the Effects and Properties Breakdown section)

If you really want to use this feature and you really know what you are doing and how to prevent the aforementioned errors you can also find the effect name by hovering it with the mouse in the Material Inspector:

<figure><img src="https://3824034177-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FE15hksY22Gpaon0DArNR%2Fuploads%2F00t4k711t70M4JWvepx9%2Fimage.png?alt=media&#x26;token=0d592058-7dd9-442b-a9f4-ce67aec3c59f" alt=""><figcaption></figcaption></figure>
