Namespace: | Sirenix.OdinInspector |
Assembly: | Sirenix.OdinInspector.Attributes |
[AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Module | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Interface | AttributeTargets.Parameter | AttributeTargets.Delegate | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter | AttributeTargets.All, AllowMultiple = false, Inherited = true)]
[Conditional("UNITY_EDITOR")]
public sealed class ColorPaletteAttribute : Attribute, _Attribute
ColorPalette is used on any Color property, and allows for choosing colors from different definable palettes.
Use this to allow the user to choose from a set of predefined color options.
See and edit the color palettes in Tools > Odin > Inspector > Preferences > Drawers > Color Palettes.
The color property is not tied to the color palette, and can be edited. Therefore the color will also not update if the ColorPalette is edited.
The following example shows how ColorPalette is applied to a property. The user can freely choose between all available ColorPalettes.
public class ColorPaletteExamples : MonoBehaviour
{
[ColorPalette]
public Color ColorOptions;
[ColorPalette("Underwater")]
public Color UnderwaterColor;
[ColorPalette("Fall"), HideLabel]
public Color WideColorPalette;
[ColorPalette("My Palette")]
public Color MyColor;
[ColorPalette("Clovers")]
public Color[] ColorArray;
}
public ColorPaletteAttribute()
public ColorPaletteAttribute(string paletteName)
System.String | paletteName | Name of the palette. |
public string PaletteName
public bool ShowAlpha