Scripting
Last updated
Last updated
If you prefer avoiding animations or want to change properties through code you also have the possibility.
You can find the property names by hovering the mouse over any property in the Material Inspector:
To do so you’ll need to use the following Unity functions:
You can find all property names on AllIn1SpriteShader/Resources/AllIn1SpriteShader.shader. All properties are located from line 5 to 225 and can also be found at the Effects and Properties Breakdown section. Here an example code snippet:
There's also an exception with materials used by a Masked UI Image where you’ll need to use “materialForRendering” instead. An example would be:
Finally ,consider that if you are trying to change a Material used in a UI component the material instances will be shared. This means that any change made to an image material will affect all other instances. To avoid this create a new copy of the material via script on an Awake method:
Material.SetFloat:
Material.SetColor:
Material.SetTexture: