GUIColorAttribute

GUIColor is used on any property and changes the GUI color used to draw the property.

namespace Sirenix.OdinInspector
{
[AttributeUsageAttribute((AttributeTargets)32767, AllowMultiple = False, Inherited = True)]
public class GUIColorAttribute : Attribute
}

Requirements

Namespace: Sirenix.OdinInspector
Assembly: Sirenix.OdinInspector
Version: 2.0.0.0

Fields

Return Type Definition Description
Color Color The GUI color of the property.
string GetColor The name of a local field, member or property that returns a Color. Both static and instance methods are supported.

Constructors

Definition Description
GUIColorAttribute(float, float, float, float) Sets the GUI color for the property.
GUIColorAttribute(string) Sets the GUI color for the property.

Example

The following example shows how GUIColor is used on a properties to create a rainbow effect.

public class MyComponent : MonoBehaviour
{
	[GUIColor(1f, 0f, 0f)]
	public int A;

	[GUIColor(1f, 0.5f, 0f, 0.2f)]
	public int B;

	[GUIColor("GetColor")]
	public int C;
	
	private Color GetColor() { return this.A == 0 ? Color.red : Color.white; }
}