HeaderGhostButton / HeaderGhostLeftButtonDraw a button in the component header, without frame and background color.
This is useful for icon buttons.
Method which returns an IEnumerator will start a coroutine
Arguments:
string label = null: label of the button.nullmeans using function name. If starts with$, then a dynamic label will be created to use a field/property/callback as label. Dynamic label when returning null or empty string will hide the button. Rich Label supported.string toolTip = null: tool tip for the button.
using SaintsField; using SaintsField.ComponentHeader; [HeaderGhostLeftButton("<icon=pencil.png/>")] public void Edit() { } [HeaderGhostButton("<icon=refresh.png/>", "Play")] public void Play() { } [HeaderGhostButton("<color=gray><icon=save.png/>", "Pause")] public void Pause() { } [HeaderGhostButton("<color=gray><icon=trash.png/>", "Resume")] public void Resume() { }

A more complex example of dynamic buttons:
using SaintsField; using SaintsField.ComponentHeader; private string _editButtonIcon = "<icon=pencil.png/>"; private bool _editing; [HeaderGhostButton("quot; + nameof(_editButtonIcon), "Edit")] private void StartEdit() { _editing = true; _editButtonIcon = ""; _saveLabel = "<color=brown><icon=save.png/>"; } [HeaderGhostButton("quot; + nameof(_saveLabel), "Save")] private IEnumerator Click() { _editing = false; _saveLabel = "<color=gray><icon=save.png/>"; foreach (int i in Enumerable.Range(0, 200)) { // Debug.Log(quot;saving {i}"); yield return null; } _saveLabel = "<color=lime><icon=check.png/>"; foreach (int i in Enumerable.Range(0, 200)) { // Debug.Log(quot;checked {i}"); yield return null; } _saveLabel = ""; _editButtonIcon = "<icon=pencil.png/>"; } private string _saveLabel = ""; [EnableIf(nameof(_editing)), OnValueChanged(nameof(OnChanged))] public string nickName; [EnableIf(nameof(_editing)), OnValueChanged(nameof(OnChanged))] public string password; [EnableIf(nameof(_editing)), OnValueChanged(nameof(OnChanged))] public int age; private void OnChanged() => _saveLabel = "<color=lime><icon=save.png/>";
It works with ShowInInspector
public interface IMyInterface { } // ... implements... [OnValueChanged(nameof(ChangeCallback)), ShowInInspector] public IMyInterface myInterface; private void ChangeCallback(IMyInterface value) { Debug.Log(value); }