Hide
Usage & Example

Basic usage: inherent from SaintsField.Editor.SaintsEditorWindow

#if UNITY_EDITOR using SaintsField.Editor; public class ExamplePanel: SaintsEditorWindow { [MenuItem("Window/Saints/Example/SaintsEditor")] public static void OpenWindow() { EditorWindow window = GetWindow<ExamplePanel>(false, "My Panel"); window.Show(); } // fields [ResizableTextArea] public string myString; [ProgressBar(100f)] public float myProgress; // life-cycle: OnUpdate function public override void OnEditorUpdate() { myProgress = (myProgress + 1f) % 100; } [ProgressBar(100f)] public float myCoroutine; // Layout supported [LayoutStart("Coroutine", ELayout.Horizontal)] private IEnumerator _startProcessing; // Button etc supported // EditorCoroutine supported [Button] public void StartIt() { StartEditorCoroutine(_startProcessing = StartProcessing()); } [Button] public void StopIt() { if (_startProcessing != null) { StopEditorCoroutine(_startProcessing); } _startProcessing = null; } private IEnumerator StartProcessing() { myCoroutine = 0; while (myCoroutine < 100f) { myCoroutine += 1f; yield return null; } } // Other life-cycle public override void OnEditorEnable() { Debug.Log("Enable"); } public override void OnEditorDisable() { Debug.Log("Disable"); } public override void OnEditorDestroy() { Debug.Log("Destroy"); } } #endif

An example of using as a ScriptableObject editor (or any serializable object)

#if UNITY_EDITOR using SaintsField.Editor; using SaintsField.Playa; public class ExampleSo: SaintsEditorWindow { [MenuItem("Window/Saints/Example/ScriptableEditor")] public static void OpenWindow() { EditorWindow window = GetWindow<ExampleSo>(false, "Scriptable Editor"); window.Show(); } [ AdvancedDropdown(nameof(ShowDropdown)), OnValueChanged(nameof(TargetChanged)) ] public ScriptableObject inspectTarget; [WindowInlineEditor] // this will inline the serialized object editor public Object editorInlineInspect; private IReadOnlyList<ScriptableObject> GetAllSo() => Resources.LoadAll<ScriptableObject>(""); private Dropdown<ScriptableObject> ShowDropdown() { Dropdown<ScriptableObject> down = new Dropdown<ScriptableObject>(); down.Add("[Null]", null); foreach (ScriptableObject scriptableObject in GetAllSo()) { down.Add(scriptableObject.name, scriptableObject); } return down; } private void TargetChanged(ScriptableObject so) { Debug.Log(
quot;changed to
{so}"); editorInlineInspect = so; titleContent = new GUIContent(so == null? "Pick One":
quot;Edit
{so.name}"); } [LayoutStart("Buttons", ELayout.Horizontal)] [Button] private void Save() {} [Button] private void Discard() {} } #endif