Extension methods for UnityEditor.SerializedProperty
.
More...
|
static void | CheckValid (this SerializedProperty property) |
| Check if the property, serializedObject, and targetObject, all exist, otherwise throw an exception. More...
|
|
static SerializedProperty | GetParent (this SerializedProperty property) |
| Get the parent UnityEditor.SerializedProperty contains this. More...
|
|
static string | GetTooltip (this SerializedProperty property) |
| Get the tooltip of the property, return string.Empty if none. More...
|
|
static void | CheckArray (this SerializedProperty property) |
| Check if the property is a valid array property. More...
|
|
static SerializedProperty | Insert (this SerializedProperty property, int index=-1, bool copy=false) |
| Insert an array element at the specified index and return it. More...
|
|
static void | AddRange (this SerializedProperty property, IEnumerable< Object > collection) |
| Add the source collection to the array property. More...
|
|
Extension methods for UnityEditor.SerializedProperty
.
static void CheckValid |
( |
this SerializedProperty |
property | ) |
|
|
static |
Check if the property, serializedObject, and targetObject, all exist, otherwise throw an exception.
- Parameters
-
static SerializedProperty GetParent |
( |
this SerializedProperty |
property | ) |
|
|
static |
Get the parent UnityEditor.SerializedProperty
contains this.
Return null
if this is a root within target object.
- Parameters
-
- Returns
- The parent.
static string GetTooltip |
( |
this SerializedProperty |
property | ) |
|
|
static |
Get the tooltip of the property, return string.Empty
if none.
The built-in SerializedProperty.tooltip
never works with unknown reason. This uses EditorGUI.BeginProperty()
to fetch the tooltip, must be called in OnGUI()
.
- Parameters
-
- Returns
- The tooltip.
static void CheckArray |
( |
this SerializedProperty |
property | ) |
|
|
static |
Check if the property is a valid array property.
- Parameters
-
static SerializedProperty Insert |
( |
this SerializedProperty |
property, |
|
|
int |
index = -1 , |
|
|
bool |
copy = false |
|
) |
| |
|
static |
Insert an array element at the specified index and return it.
Optional to copy values from the original element at the index, like the Unity's default behavior. Otherwise Leave all the values empty.
- Parameters
-
property | Property. |
index | Index. |
copy | If set to true copy. |
- Returns
- Element property.
static void AddRange |
( |
this SerializedProperty |
property, |
|
|
IEnumerable< Object > |
collection |
|
) |
| |
|
static |
Add the source collection
to the array property.
- Parameters
-
property | Property. |
collection | Collection. |