ColorToggleA toggle button to toggle color for Image, Button, SpriteRenderer or Renderer
The field itself must be Color.
-
string compName=nullthe target, must be
Image,Button,SpriteRenderer, orRenderer(or its subClass likeMeshRenderer).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.colorproperty.When it's a
Button, it will change the button'stargetGraphic.colorproperty. -
int index=0(only works for
Renderertype) which slot index ofmaterialsonRendereryou 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;