Class MoreEditorGUI
The class contains some convenient methods that extend on Unity's IMGUI methods.
Inheritance
Namespace: InsaneScatterbrain.Tools.Editor
Syntax
public static class MoreEditorGUI
Methods
CheckFilenameFriendly(String)
Checks if the given text could be used as a valid filename. Shows a dialog with a warning, if not.
Declaration
public static bool CheckFilenameFriendly(string text)
Parameters
Type | Name | Description |
---|---|---|
System.String | text | The text. |
Returns
Type | Description |
---|---|
System.Boolean | Whether text is a valid filename. |
DeleteButton<T>(T, Action<T>, String)
Button to delete an object.
Declaration
public static void DeleteButton<T>(T deleteObj, Action<T> deleteAction, string buttonText = "Delete")
where T : class
Parameters
Type | Name | Description |
---|---|---|
T | deleteObj | The object to delete. |
System.Action<T> | deleteAction | The action that deletes the object. |
System.String | buttonText | The text displayed on the button. |
Type Parameters
Name | Description |
---|---|
T |
NewButton<T>(Func<T>, String)
Button to create a new object.
Declaration
public static T NewButton<T>(Func<T> createFunc, string buttonText = "New")
where T : class
Parameters
Type | Name | Description |
---|---|---|
System.Func<T> | createFunc | The function that returns a new instance of T. |
System.String | buttonText | The text displayed on the button. |
Returns
Type | Description |
---|---|
T |
Type Parameters
Name | Description |
---|---|
T | The object's type. |
Popup<T>(T, T[], String)
Creates a popup field for a specific type. ToString is used to represent this object in the popup.
Declaration
public static T Popup<T>(T selectedObject, T[] options, string emptyValue)
where T : class
Parameters
Type | Name | Description |
---|---|---|
T | selectedObject | The selected object. |
T[] | options | The selectable objects. |
System.String | emptyValue | The text used for no active selection. Null if a selection is required. |
Returns
Type | Description |
---|---|
T | The new selected object. |
Type Parameters
Name | Description |
---|---|
T | The type. |
PopupNewDelete<T>(T, T[], String, Func<T>, Action<T>, String)
Creates an object popup with a new button and delete button.
Declaration
public static T PopupNewDelete<T>(T selectedObject, T[] options, string emptyValue, Func<T> createFunc, Action<T> deleteFunc, string newButtonText = "New")
where T : class
Parameters
Type | Name | Description |
---|---|---|
T | selectedObject | The currently selected object. |
T[] | options | The selectable objects. |
System.String | emptyValue | The text for no selection. Null, if that's not allowed. |
System.Func<T> | createFunc | The function that returns a new instance of T. |
System.Action<T> | deleteFunc | The action that deletes the object. |
System.String | newButtonText | The text displayed on the button. |
Returns
Type | Description |
---|---|
T |
Type Parameters
Name | Description |
---|---|
T | The type. |