Version 3.3.1.2

OdinObjectSelector class

Namespace: Sirenix.OdinInspector.Editor
Assembly: Sirenix.OdinInspector.Editor
public static class OdinObjectSelector
Inheritance
  • System.Object
  • OdinObjectSelector

Properties

IsOpen
public static bool IsOpen { get; }
SelectorId
The id to identify who called the selector.
public static int SelectorId { get; }
SelectorKey
The key to identify who called the selector.
public static object SelectorKey { get; }
SelectorObject
The current selected object.
public static object SelectorObject { get; }

Methods

Claim()
Claims the current SelectorObject.
public static object Claim()
Returns
System.Object

The SelectorObject if it is ready to be claimed; otherwise, NULL with an accompanying error message.

ClaimMultiple(Int32)
Claims the current SelectorObject and copies a specified amount (amount) of instances of the SelectorObject.
public static object[] ClaimMultiple(int amount)
Parameters
System.Int32 amount

The number of instances to copy.

Returns
System.Object[]

An array of SelectorObject copies, where element 0 is always the original value, if the SelectorObject is ready to be claimed; otherwise, NULL with an accompanying error message.

GetChangedObject<T>(T, Object, Int32)
If the object was changed since the last time this method was called, it returns the changed object (SelectorObject); otherwise, it returns the provided value.
public static T GetChangedObject<T>(T value, object key, int id)
Parameters
T value

The current value; the value to return if no change has occurred.

System.Object key

The key to identify who showed the current selector.

System.Int32 id

The ID to identify who showed the current selector.

Returns
T

SelectorObject if it was marked as changed, otherwise value.

Type Parameters
T

The type of object to expect as a return value.

IsCurrentSelector(Object, Int32)
Determines whether the specified key and id combination match the currently open selectors.
public static bool IsCurrentSelector(object key, int id)
Parameters
System.Object key

The key to match.

System.Int32 id

The ID to match.

Returns
System.Boolean

true if the combination is a match; otherwise, false.

IsReadyToClaim(Object, Int32)
Checks if the selector's object is ready to be claimed.
public static bool IsReadyToClaim(object key, int id)
Parameters
System.Object key

The key to identify who showed the current selector.

System.Int32 id

The ID to identify who showed the current selector.

Returns
System.Boolean

true if the selector's object (SelectorObject) is ready to be claimed; otherwise, false.

Show(Object, Int32, Object, Type, Boolean, Boolean, Rect)
Shows a selector.
public static void Show(object key, int id, object value, Type baseType, bool allowSceneObjects = true, bool disallowNullValues = false, Rect position = null)
Parameters
System.Object key

The key used to identify who called the selector; this can be null.

System.Int32 id

The ID used to identify who called the selector; this can be 0.

System.Object value

The current value selected.

System.Type baseType

The base type of the 'value'.

System.Boolean allowSceneObjects

Determines if scene objects are allowed.

System.Boolean disallowNullValues

Determines if null values are allowed.

UnityEngine.Rect position

The position where the selector should appear.

Exceptions
System.NotImplementedException

Thrown if the selector was opened for a case that it didn't expect.