Version: 2017.4

SerializedProperty

class in UnityEditor

マニュアルに切り替える

説明

SerializedProperty と SerializedObject は、例えばプレハブの UI の Undo とスタイリングを自動的に処理する一般的な方法として、オブジェクトのプロパティーを編集するためのクラスです。

SerializedProperty は主に SerializedObjectEditor クラスを組み合わせて使用します。 参照: SerializedObject クラス、 Editor クラス

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)
arraySize配列内の要素数 SerializedObject に複数のオブジェクトが含まれている場合、最も小さい要素数を返します。よって、いつでも SerializedObject を通してイテレートすることと、すべてのオブジェクトで get プロパティーだけを探すことが可能です。
boolValueboolean プロパティーの値
boundsIntValueValue of bounds with integer values property.
boundsValueBounds プロパティーの値
colorValuecolor プロパティーの値
depthプロパティーのネストの深さ (読み取り専用)
displayName最適なプロパティーの表示名 (読み取り専用)
doubleValuedouble として float プロパティーの値
editableプロパティーが編集可能かどうか (読み取り専用)
enumDisplayNamesenum プロパティーの表示しやすい列挙型名
enumNamesenum プロパティーの列挙型名
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 プロパティーの値
hasChildren子のプロパティーを持つかどうか (読み取り専用)
hasMultipleDifferentValuesこのプロパティーは複数編集のため、複数の異なる値を持っているかどうか (読み取り専用)
hasVisibleChildrenVisible の子のプロパティーを持つかどうか (読み取り専用)
intValue整数のプロパティーの値
isArrayプロパティーが配列かどうか (読み取り専用)
isExpandedインスペクター上でこのプロパティーを展開するかどうか (読み取り専用)
isFixedBufferIs this property a fixed buffer? (Read Only)
isInstantiatedPrefabプレハブインスタンスのプロパティーの一部かどうか (読み取り専用)
longValueLong としての整数のプロパティーの値
nameプロパティー名 (読み取り専用)
objectReferenceValue参照オブジェクトのプロパティーの値
prefabOverrideプロパティーの値がプレハブに保存されている値と異なるかどうか
propertyPathプロパティーのフルパス (読み取り専用)
propertyTypeプロパティーのタイプ (読み取り専用)
quaternionValueQuaternion プロパティーの値
rectIntValueValue of a rectangle with integer values property.
rectValueRect プロパティーの値
serializedObject SerializedObject this property belongs to (Read Only).
stringValuestring プロパティーの値
tooltipプロパティーのツールチップ (読み取り専用)
typeプロパティーのタイプ名 (読み取り専用)
vector2IntValueValue of a 2D integer vector property.
vector2ValueVector2 プロパティーの値
vector3IntValueValue of a 3D integer vector property.
vector3ValueVector3 プロパティーの値
vector4ValueVector4 プロパティーの値

Public 関数

ClearArray配列からすべてのエレメントを削除します
Copy現在の状態の SerializedProperty イテレーターのコピーを返し、現在のプロパティーへの参照を維持しますが、イテレーションを続行する場合に便利です。
CountInPropertyこのプロパティー自体を含む、このプロパティーの Visible children (見えている子) をカウントします
CountRemaining残りの Visible プロパティーをカウントします
DeleteArrayElementAtIndex配列内の指定したインデックスにあるエレメントを削除します
DeleteCommandシリアライズされたプロパティーを削除します
DuplicateCommandシリアライズされたプロパティーを複製します
FindPropertyRelative現在のプロパティーへの相対パスで SerializedProperty を取得してきます
GetArrayElementAtIndex配列内の指定したインデックスにあるエレメントを返します
GetEndPropertyこのプロパティーの範囲の終わりを定義する SerializedProperty を取得します
GetEnumerator現在のシリアライズされたプロパティーの Next() を反復処理するイテレータを取得します
GetFixedBufferElementAtIndexReturns the element at the specified index in the fixed buffer.
InsertArrayElementAtIndex空のエレメントを配列内の指定したインデックスに挿入します
MoveArrayElementsrcIndex から dstIndex に配列エレメントを移動します
Next次のプロパティーに移動します
NextVisible次の Visible プロパティーに移動します
Resetオブジェクトの最初のプロパティーに移動します

Static 関数

EqualContents2つの SerializedProperty が等しいかどうかを確認します。