Hide
ColorToggle

A toggle button to toggle color for Image, Button, SpriteRenderer or Renderer

The field itself must be Color.

  • string compName=null

    the target, must be Image, Button, SpriteRenderer, or Renderer (or its subClass like MeshRenderer).

    When using null, it will try to get the correct component from the target object of this field by order.

    When it's a Renderer, it will change the material's .color property.

    When it's a Button, it will change the button's targetGraphic.color property.

  • int index=0

    (only works for Renderer type) which slot index of materials on Renderer you want to apply the color

  • AllowMultiple: Yes

using SaintsField; // auto find on the target object [SerializeField, ColorToggle] private Color _onColor; [SerializeField, ColorToggle] private Color _offColor; [Space] // by name [SerializeField] private Image _image; [SerializeField, ColorToggle(nameof(_image))] private Color _onColor2; [SerializeField, ColorToggle(nameof(_image))] private Color _offColor2;