Version: 2022.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); } }

変数

animationCurveValueアニメーションカーブのプロパティーの値
arrayElementTypeType name of the element in an array property. (Read Only)
arraySizeThe number of elements in the array.
boolValueboolean プロパティーの値
boundsIntValueValue of bounds with integer values property.
boundsValueBounds プロパティーの値
boxedValueValue of the SerializedProperty, boxed as a System.Object.
colorValuecolor プロパティーの値
contentHashProvides the hash value for the property. (Read Only)
depthプロパティーのネストの深さ (読み取り専用)
displayName最適なプロパティーの表示名 (読み取り専用)
doubleValuedouble として float プロパティーの値
editableプロパティーが編集可能かどうか (読み取り専用)
enumDisplayNamesenum プロパティーの表示しやすい列挙型名
enumNamesenum プロパティーの列挙型名
enumValueFlagInt32 representation of an enum property with Mixed Values.
enumValueIndexenum プロパティーの enum インデックス
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)
floatValuefloat プロパティーの値
gradientValueGradient プロパティーの値
hasChildren子のプロパティーを持つかどうか (読み取り専用)
hash128ValueThe value of a Hash128 property.
hasMultipleDifferentValuesこのプロパティーは複数編集のため、複数の異なる値を持っているかどうか (読み取り専用)
hasVisibleChildrenVisible の子のプロパティーを持つかどうか (読み取り専用)
intValue整数のプロパティーの値
isArrayプロパティーが配列かどうか (読み取り専用)
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.
isExpandedインスペクター上でこのプロパティーを展開するかどうか (読み取り専用)
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)
nameプロパティー名 (読み取り専用)
numericTypeReturn the precise type for Integer and Floating point properties. (Read Only)
objectReferenceValue参照オブジェクトのプロパティーの値
prefabOverrideAllows you to check whether a property's value is overriden (i.e. different to the Prefab it belongs to).
propertyPathプロパティーのフルパス (読み取り専用)
propertyTypeプロパティーのタイプ (読み取り専用)
quaternionValueQuaternion プロパティーの値
rectIntValueValue of a rectangle with integer values property.
rectValueRect プロパティーの値
serializedObject SerializedObject this property belongs to (Read Only).
stringValuestring プロパティーの値
tooltipプロパティーのツールチップ (読み取り専用)
typeプロパティーのタイプ名 (読み取り専用)
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.
vector2ValueVector2 プロパティーの値
vector3IntValueValue of a 3D integer vector property.
vector3ValueVector3 プロパティーの値
vector4ValueVector4 プロパティーの値

Public 関数

ClearArray配列からすべてのエレメントを削除します
CopyReturns a copy of the SerializedProperty iterator in its current state.
CountInPropertyこのプロパティー自体を含む、このプロパティーの Visible children (見えている子) をカウントします
CountRemaining残りの Visible プロパティーをカウントします
DeleteArrayElementAtIndex配列内の指定したインデックスにあるエレメントを削除します
DeleteCommandDeletes the array element referenced by the SerializedProperty.
DuplicateCommandDuplicates the array element referenced by the SerializedProperty.
FindPropertyRelative現在のプロパティーへの相対パスで SerializedProperty を取得してきます
GetArrayElementAtIndex配列内の指定したインデックスにあるエレメントを返します
GetEndPropertyこのプロパティーの範囲の終わりを定義する SerializedProperty を取得します
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.
MoveArrayElementsrcIndex から dstIndex に配列エレメントを移動します
Next次のプロパティーに移動します
NextVisible次の Visible プロパティーに移動します
Resetオブジェクトの最初のプロパティーに移動します

Static 関数

DataEqualsCompares the data for two SerializedProperties. This method ignores paths and SerializedObjects.
EqualContents2つの SerializedProperty が等しいかどうかを確認します。