Namespace: | Sirenix.OdinInspector.Editor |
Assembly: | Sirenix.OdinInspector.Editor |
[ShowOdinSerializedPropertiesInInspector]
public class OdinEditorWindow : EditorWindow, ISerializationCallbackReceiver
public class SomeWindow : OdinEditorWindow
{
[MenuItem("My Game/Some Window")]
private static void OpenWindow()
{
GetWindow<SomeWindow>().Show();
}
[Button(ButtonSizes.Large)]
public void SomeButton() { }
[TableList]
public SomeType[] SomeTableData;
}
public class DrawSomeSingletonInAnEditorWindow : OdinEditorWindow
{
[MenuItem("My Game/Some Window")]
private static void OpenWindow()
{
GetWindow<DrawSomeSingletonInAnEditorWindow>().Show();
}
protected override object GetTarget()
{
return MySingleton.Instance;
}
}
private void InspectObjectInWindow()
{
OdinEditorWindow.InspectObject(someObject);
}
private void InspectObjectInDropDownWithAutoHeight()
{
var btnRect = GUIHelper.GetCurrentLayoutRect();
OdinEditorWindow.InspectObjectInDropDown(someObject, btnRect, btnRect.width);
}
private void InspectObjectInDropDown()
{
var btnRect = GUIHelper.GetCurrentLayoutRect();
OdinEditorWindow.InspectObjectInDropDown(someObject, btnRect, new Vector2(btnRect.width, 100));
}
private void InspectObjectInACenteredWindow()
{
var window = OdinEditorWindow.InspectObject(someObject);
window.position = GUIHelper.GetEditorWindowRect().AlignCenter(270, 200);
}
private void OtherStuffYouCanDo()
{
var window = OdinEditorWindow.InspectObject(this.someObject);
window.position = GUIHelper.GetEditorWindowRect().AlignCenter(270, 200);
window.titleContent = new GUIContent("Custom title", EditorIcons.RulerRect.Active);
window.OnClose += () => Debug.Log("Window Closed");
window.OnBeginGUI += () => GUILayout.Label("-----------");
window.OnEndGUI += () => GUILayout.Label("-----------");
}
public OdinEditorWindow()
public const int MAX_DROPDOWN_HEIGHT = 600
public const int MIN_DROPDOWN_HEIGHT = 200
protected ImmutableList<object> CurrentDrawingTargets { get; }
public virtual float DefaultEditorPreviewHeight { get; set; }
public virtual float DefaultLabelWidth { get; set; }
public virtual bool DrawUnityEditorPreview { get; set; }
public virtual bool UseScrollView { get; set; }
public virtual Vector4 WindowPadding { get; set; }
public static OdinEditorWindow CreateOdinEditorWindowInstanceForObject(object obj)
System.Object | obj |
OdinEditorWindow |
protected virtual void DrawEditor(int index)
System.Int32 | index |
protected virtual void DrawEditorPreview(int index, float height)
System.Int32 | index | |
System.Single | height |
protected virtual void DrawEditors()
protected void EnableAutomaticHeightAdjustment(int maxHeight, bool retainInitialWindowPosition)
System.Int32 | maxHeight | The max height of the window. |
System.Boolean | retainInitialWindowPosition | When the window height expands below the screen bounds, it will move the window upwards when needed, enabling this will move it back down when the window height is decreased. |
protected void EnsureEditorsAreReady()
protected virtual object GetTarget()
System.Object |
protected virtual IEnumerable<object> GetTargets()
System.Collections.Generic.IEnumerable<System.Object> |
protected virtual void Initialize()
public static OdinEditorWindow InspectObject(OdinEditorWindow window, object obj)
OdinEditorWindow | window | |
System.Object | obj |
OdinEditorWindow |
public static OdinEditorWindow InspectObject(object obj)
System.Object | obj |
OdinEditorWindow |
Pops up an editor window for the given object in a drop-down window which closes when it loses its focus.
Protip: You can subscribe to OnClose if you want to know when that occurs.
public static OdinEditorWindow InspectObjectInDropDown(object obj)
System.Object | obj |
OdinEditorWindow |
Pops up an editor window for the given object in a drop-down window which closes when it loses its focus.
Protip: You can subscribe to OnClose if you want to know when that occurs.
public static OdinEditorWindow InspectObjectInDropDown(object obj, float windowWidth)
System.Object | obj | |
System.Single | windowWidth |
OdinEditorWindow |
Pops up an editor window for the given object in a drop-down window which closes when it loses its focus.
Protip: You can subscribe to OnClose if you want to know when that occurs.
public static OdinEditorWindow InspectObjectInDropDown(object obj, float width, float height)
System.Object | obj | |
System.Single | width | |
System.Single | height |
OdinEditorWindow |
Pops up an editor window for the given object in a drop-down window which closes when it loses its focus. This particular overload uses a few frames to calculate the height of the content before showing the window with a height that matches its content.
Protip: You can subscribe to OnClose if you want to know when that occurs.
public static OdinEditorWindow InspectObjectInDropDown(object obj, Rect btnRect, float windowWidth)
System.Object | obj | |
UnityEngine.Rect | btnRect | |
System.Single | windowWidth |
OdinEditorWindow |
Pops up an editor window for the given object in a drop-down window which closes when it loses its focus.
Protip: You can subscribe to OnClose if you want to know when that occurs.
public static OdinEditorWindow InspectObjectInDropDown(object obj, Rect btnRect, Vector2 windowSize)
System.Object | obj | |
UnityEngine.Rect | btnRect | |
UnityEngine.Vector2 | windowSize |
OdinEditorWindow |
Pops up an editor window for the given object in a drop-down window which closes when it loses its focus.
Protip: You can subscribe to OnClose if you want to know when that occurs.
public static OdinEditorWindow InspectObjectInDropDown(object obj, Vector2 position)
System.Object | obj | |
UnityEngine.Vector2 | position |
OdinEditorWindow |
Pops up an editor window for the given object in a drop-down window which closes when it loses its focus.
Protip: You can subscribe to OnClose if you want to know when that occurs.
public static OdinEditorWindow InspectObjectInDropDown(object obj, Vector2 position, float windowWidth)
System.Object | obj | |
UnityEngine.Vector2 | position | |
System.Single | windowWidth |
OdinEditorWindow |
protected virtual void OnAfterDeserialize()
protected virtual void OnBeforeSerialize()
protected virtual void OnBeginDrawEditors()
protected virtual void OnDestroy()
protected virtual void OnDisable()
protected virtual void OnEnable()
protected virtual void OnEndDrawEditors()
protected virtual void OnImGUI()
public void ShowToast(ToastPosition toastPosition, SdfIconType icon, string text, Color color, float duration)
ToastPosition | toastPosition | |
SdfIconType | icon | |
System.String | text | |
UnityEngine.Color | color | |
System.Single | duration |
protected void UpdateEditors()
public event Action OnBeginGUI
public event Action OnClose
public event Action OnEndGUI