Version: 2017.1

SerializedProperty

class in UnityEditor

매뉴얼로 전환

설명

SerializedProperty and SerializedObject are classes for editing properties on objects in a completely generic way that automatically handles undo and styling UI for prefabs.

SerializedProperty is used in conjunction with SerializedObject and Editor classes. See Also: SerializedObject class, Editor class.

using UnityEngine;
using UnityEditor;

public class MyObject : ScriptableObject { public int myInt = 42; }

public class SerializedPropertyTest : MonoBehaviour { void Start() { MyObject obj = ScriptableObject.CreateInstance<MyObject>(); SerializedObject serializedObject = new UnityEditor.SerializedObject(obj);

SerializedProperty serializedPropertyMyInt = serializedObject.FindProperty("myInt");

Debug.Log("myInt " + serializedPropertyMyInt.intValue); } }

변수

animationCurveValueValue of a animation curve property.
arrayElementTypeType name of the element in an array property. (Read Only)
arraySizeThe number of elements in the array. If the SerializedObject contains multiple objects it will return the smallest number of elements. So it is always possible to iterate through the SerializedObject and only get properties found in all objects.
boolValueValue of a boolean property.
boundsValueValue of bounds property.
colorValueValue of a color property.
depthNesting depth of the property. (Read Only)
displayNameNice display name of the property. (Read Only)
doubleValueValue of a float property as a double.
editableIs this property editable? (Read Only)
enumDisplayNamesDisplay-friendly names of enumeration of an enum property.
enumNamesNames of enumeration of an enum property.
enumValueIndexEnum index of an enum property.
exposedReferenceValueA reference to another Object in the Scene. This reference is resolved in the context of the SerializedObject containing the SerializedProperty.
fixedBufferSizeThe number of elements in the fixed buffer. (Read Only)
floatValueValue of a float property.
hasChildrenDoes it have child properties? (Read Only)
hasMultipleDifferentValuesDoes this property represent multiple different values due to multi-object editing? (Read Only)
hasVisibleChildrenDoes it have visible child properties? (Read Only)
intValueValue of an integer property.
isArrayIs this property an array? (Read Only)
isExpandedIs this property expanded in the inspector?
isFixedBufferIs this property a fixed buffer? (Read Only)
isInstantiatedPrefabIs property part of a prefab instance? (Read Only)
longValueValue of a integer property as a long.
nameName of the property. (Read Only)
objectReferenceValueValue of an object reference property.
prefabOverrideIs property's value different from the prefab it belongs to?
propertyPathFull path of the property. (Read Only)
propertyTypeType of this property (Read Only).
quaternionValueValue of a quaternion property.
rectValueValue of a rectangle property.
serializedObject SerializedObject this property belongs to (Read Only).
stringValueValue of a string property.
tooltipTooltip of the property. (Read Only)
typeType name of the property. (Read Only)
vector2ValueValue of a 2D vector property.
vector3ValueValue of a 3D vector property.
vector4ValueValue of a 4D vector property.

Public 함수

ClearArrayRemove all elements from the array.
CopyReturns a copy of the SerializedProperty iterator in its current state. This is useful if you want to keep a reference to the current property but continue with the iteration.
CountInPropertyCount visible children of this property, including this property itself.
CountRemainingCount remaining visible properties.
DeleteArrayElementAtIndexDelete the element at the specified index in the array.
DeleteCommandDeletes the serialized property.
DuplicateCommandDuplicates the serialized property.
FindPropertyRelativeRetrieves the SerializedProperty at a relative path to the current property.
GetArrayElementAtIndexReturns the element at the specified index in the array.
GetEndPropertyRetrieves the SerializedProperty that defines the end range of this property.
GetEnumeratorRetrieves an iterator that allows you to iterator over the current nexting of a serialized property.
GetFixedBufferElementAtIndexReturns the element at the specified index in the fixed buffer.
InsertArrayElementAtIndexInsert an empty element at the specified index in the array.
MoveArrayElementMove an array element from srcIndex to dstIndex.
NextMove to next property.
NextVisibleMove to next visible property.
ResetMove to first property of the object.

정적 함수

EqualContentsSee if contained serialized properties are equal.