Skip to main content
100%

A Material Property Drawer for the [Gradient] attribute which lets you edit gradients and adds them to the shader as textures. More information here: https://twitter.com/totallyRonja/status/1368704187580682240

✓ Published0🌍 Public
Aandybak
Last edited Mar 8, 2021
Created on Mar 8, 2021

This drawer adds a gradient editor to Unity’s Material Inspector for shader properties marked with the `[Gradient]` attribute. It converts the edited gradient into a 1D texture, bakes it using `Texture2D.SetPixel` and `Apply`, and assigns it to the material via `Material.SetTexture`. The tool stores and reloads gradients by encoding them as JSON in the texture’s asset name, using `JsonUtility` and `AssetDatabase` for persistence, with a fallback blue-to-red default.

AI-generated description

Similar vizzes