Version: 2023.2
언어: 한국어

SerializedProperty

class in UnityEditor

매뉴얼로 전환

설명

SerializedProperty and SerializedObject are classes for editing properties on objects in a completely generic way that automatically handles undo, multi-object editing and Prefab overrides.

SerializedProperty is primarily used to read or change the value of a property. It can also iterate through the properties of an object using Next. 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.
boolValueValue of a boolean property.
boundsIntValueValue of bounds with integer values property.
boundsValueValue of bounds property.
boxedValueValue of the SerializedProperty, boxed as a System.Object.
colorValueValue of a color property.
contentHashProvides the hash value for the property. (Read Only)
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.
enumValueFlagInt32 representation of an enum property with Mixed Values.
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.
gradientValueValue of a gradient property.
hasChildrenDoes it have child properties? (Read Only)
hash128ValueThe value of a Hash128 property.
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)
isDefaultOverrideAllows you to check whether his property is a default override.Certain properties on Prefab instances are default overrides.See PrefabUtility.IsDefaultOverride for more information.
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 an integer property as a long.
managedReferenceFieldTypenameString corresponding to the value of the managed reference field full type string.
managedReferenceFullTypenameString corresponding to the value of the managed reference object (dynamic) full type string.
managedReferenceIdId associated with a managed reference.
managedReferenceValueThe object assigned to a field with SerializeReference attribute.
minArraySizeThe smallest number of elements in the array across all target objects. (Read Only)
nameName of the property. (Read Only)
numericTypeReturn the precise type for Integer and Floating point properties. (Read Only)
objectReferenceValueValue of an object reference property.
prefabOverrideAllows you to check whether a property's value is overriden (i.e. different to the Prefab it belongs to).
propertyPathFull path of the property. (Read Only)
propertyTypeType of this property (Read Only).
quaternionValueValue of a quaternion property.
rectIntValueValue of a rectangle with integer values 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)
uintValueValue of an integer property as an unsigned int.
ulongValueValue of an integer property as an unsigned long.
vector2IntValueValue of a 2D integer vector property.
vector2ValueValue of a 2D vector property.
vector3IntValueValue of a 3D integer 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.
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 array element referenced by the SerializedProperty.
DuplicateCommandDuplicates the array element referenced by the SerializedProperty.
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 for enumerating over the visible child properties of the current property. If the property is an array it will enumerate over the array elements.
GetFixedBufferElementAtIndexReturns the element at the specified index in the fixed buffer.
InsertArrayElementAtIndexInsert an new 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.

정적 함수

DataEqualsCompares the data for two SerializedProperties. This method ignores paths and SerializedObjects.
EqualContentsSee if contained serialized properties are equal.
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961