Scheduled Maintenance
9th of July 2025 at 10:00 AM, we'll be taking the site down for scheduled maintenance.

On Value Changed Attribute

OnValueChanged works on properties and fields, and calls the specified function whenever the value has been changed via the inspector.

[OnValueChanged("CreateMaterial")] public Shader Shader; [ReadOnly, InlineEditor(InlineEditorModes.LargePreview)] public Material Material; private void CreateMaterial() { if (this.Material != null) { Material.DestroyImmediate(this.Material); } if (this.Shader != null) { this.Material = new Material(this.Shader); } }