← All resources

totallyRonja GitHub - Gradient Material Property Drawer

Auto-discovered

Library / Codebase Intermediate

totallyRonja

Visit resource ↗

Description

totallyRonja's GitHub Gist provides MaterialGradientDrawer.cs, a Unity MaterialPropertyDrawer for a custom [Gradient] shader attribute. March 2021 gist with an author thread on the idea.

The drawer binds to texture material properties and shows Unity's gradient field in the Inspector. Edits bake to a 1x256 Texture2D sub-asset by default; JsonUtility encodes keys in the sub-asset name so gradients reload with the material.

For intermediate shader authors building toon ramps or VFX curves without external PNG files. Needs UnityEditor APIs, saved materials, and shaders that sample the baked lookup.

One public gist with a few forks, not a package. Validates property types, supports multi-edit, and offers a menu command to remove subassets.

Keeps ramp editing in Unity while shaders sample a stable texture. Niche but often mirrored where Shader Graph lacks a native gradient property.