Animate UI Material
>-
com.lgarczyn.animate-ui-material Install via UPM
Add to Unity Package Manager using this URL
https://www.pkglnk.dev/animate-ui-material.git README Markdown
Copy this to your project's README.md
## Installation
Add **Animate UI Material** to your Unity project via Package Manager:
1. Open **Window > Package Manager**
2. Click **+** > **Add package from git URL**
3. Enter:
```
https://www.pkglnk.dev/animate-ui-material.git
```
[](https://www.pkglnk.dev/pkg/animate-ui-material)README

Introduction
Animate UI Materials allows editing and animating materials for a single UI component.

Installation
This package required 2021.3 or later
Install with OpenUPM
openupm add com.lgarczyn.animate-ui-material/
Install with the Unity Package Manager
- In the Unity Editor
- Open the Windows Menu
- Open the Package Manager
- Press +
- Add Package from git URL
- Enter
https://github.com/lgarczyn/AnimateUIMaterials.git
Install With Asset Store
Use the Unity Asset Store
Download Directly
Download asset from Releases folder
Setup
Import the package into your project
Simply add the GraphicMaterialOverride component to an UI element, such as an Image with a custom Material

When selecting the dropdown “Add Override”, you will be greeted with every possible property you can animate.

You can ignore those you don’t know, such as the _Stencil properties. They are internal to UI stencil rendering. Simply select “_Color” for example.
Two things will happen:
A new modifier will be listed in the GraphicMaterialOverride component
You can already edit the color value, and the change will only affect the Image componentA new gameobject will be created, holding a GraphicPropertyOverride component
The value displayed here is the exact same as in the GraphicMaterialComponent. However this value can also be animated.
Animation
To animate the property, add the usual Animator component to the image

Create a new AnimationClip

Click Add Property and select _Color Override, then Graphic Property Override Color, then Graphic Property Override Color.Property Value

You can now animate the value like any other !

Alternatively, hit the Record button, and simply modify the properties from the GraphicMaterialOverride inspector


Baking
To get the final modified material as a material asset, simply open the context menu of your GraphicMaterialOverride or Graphic and press "Bake Modified Material". A new material variant will be saved alongside the source material.
End Notes
If you encounter a bug or need any help, please contact me at fleeting.being.official@gmail.com
Don’t hesitate to look into the code if you want to know how things work !
No comments yet. Be the first!