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 | アニメーションカーブのプロパティーの値 |
| arrayElementType | Type name of the element in an array property. (Read Only) |
| arraySize | The number of elements in the array. |
| boolValue | boolean プロパティーの値 |
| boundsIntValue | Value of bounds with integer values property. |
| boundsValue | Bounds プロパティーの値 |
| boxedValue | Value of the SerializedProperty, boxed as a System.Object. |
| colorValue | color プロパティーの値 |
| contentHash | Provides the hash value for the property. (Read Only) |
| depth | プロパティーのネストの深さ (読み取り専用) |
| displayName | 最適なプロパティーの表示名 (読み取り専用) |
| doubleValue | double として float プロパティーの値 |
| editable | プロパティーが編集可能かどうか (読み取り専用) |
| enumDisplayNames | enum プロパティーの表示しやすい列挙型名 |
| enumNames | enum プロパティーの列挙型名 |
| enumValueFlag | Int32 representation of an enum property with Mixed Values. |
| enumValueIndex | enum プロパティーの enum インデックス |
| exposedReferenceValue | A reference to another Object in the Scene. This reference is resolved in the context of the SerializedObject containing the SerializedProperty. |
| fixedBufferSize | The number of elements in the fixed buffer. (Read Only) |
| floatValue | float プロパティーの値 |
| gradientValue | Gradient プロパティーの値 |
| hasChildren | 子のプロパティーを持つかどうか (読み取り専用) |
| hash128Value | The value of a Hash128 property. |
| hasMultipleDifferentValues | このプロパティーは複数編集のため、複数の異なる値を持っているかどうか (読み取り専用) |
| hasVisibleChildren | Visible の子のプロパティーを持つかどうか (読み取り専用) |
| intValue | 整数のプロパティーの値 |
| isArray | プロパティーが配列かどうか (読み取り専用) |
| isDefaultOverride | Allows 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 | インスペクター上でこのプロパティーを展開するかどうか (読み取り専用) |
| isFixedBuffer | Is this property a fixed buffer? (Read Only) |
| isInstantiatedPrefab | Is property part of a Prefab instance? (Read Only) |
| longValue | Value of an integer property as a long. |
| managedReferenceFieldTypename | String corresponding to the value of the managed reference field full type string. |
| managedReferenceFullTypename | String corresponding to the value of the managed reference object (dynamic) full type string. |
| managedReferenceId | Id associated with a managed reference. |
| managedReferenceValue | The object assigned to a field with SerializeReference attribute. |
| minArraySize | The smallest number of elements in the array across all target objects. (Read Only) |
| name | プロパティー名 (読み取り専用) |
| numericType | Return the precise type for Integer and Floating point properties. (Read Only) |
| objectReferenceValue | 参照オブジェクトのプロパティーの値 |
| prefabOverride | Allows you to check whether a property's value is overriden (i.e. different to the Prefab it belongs to). |
| propertyPath | プロパティーのフルパス (読み取り専用) |
| propertyType | プロパティーのタイプ (読み取り専用) |
| quaternionValue | Quaternion プロパティーの値 |
| rectIntValue | Value of a rectangle with integer values property. |
| rectValue | Rect プロパティーの値 |
| serializedObject | SerializedObject this property belongs to (Read Only). |
| stringValue | string プロパティーの値 |
| tooltip | プロパティーのツールチップ (読み取り専用) |
| type | プロパティーのタイプ名 (読み取り専用) |
| uintValue | Value of an integer property as an unsigned int. |
| ulongValue | Value of an integer property as an unsigned long. |
| vector2IntValue | Value of a 2D integer vector property. |
| vector2Value | Vector2 プロパティーの値 |
| vector3IntValue | Value of a 3D integer vector property. |
| vector3Value | Vector3 プロパティーの値 |
| vector4Value | Vector4 プロパティーの値 |
| ClearArray | 配列からすべてのエレメントを削除します |
| Copy | Returns a copy of the SerializedProperty iterator in its current state. |
| CountInProperty | このプロパティー自体を含む、このプロパティーの Visible children (見えている子) をカウントします |
| CountRemaining | 残りの Visible プロパティーをカウントします |
| DeleteArrayElementAtIndex | 配列内の指定したインデックスにあるエレメントを削除します |
| DeleteCommand | Deletes the array element referenced by the SerializedProperty. |
| DuplicateCommand | Duplicates the array element referenced by the SerializedProperty. |
| FindPropertyRelative | 現在のプロパティーへの相対パスで SerializedProperty を取得してきます |
| GetArrayElementAtIndex | 配列内の指定したインデックスにあるエレメントを返します |
| GetEndProperty | このプロパティーの範囲の終わりを定義する SerializedProperty を取得します |
| GetEnumerator | Retrieves 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. |
| GetFixedBufferElementAtIndex | Returns the element at the specified index in the fixed buffer. |
| InsertArrayElementAtIndex | Insert an new element at the specified index in the array. |
| MoveArrayElement | srcIndex から dstIndex に配列エレメントを移動します |
| Next | 次のプロパティーに移動します |
| NextVisible | 次の Visible プロパティーに移動します |
| Reset | オブジェクトの最初のプロパティーに移動します |
| DataEquals | Compares the data for two SerializedProperties. This method ignores paths and SerializedObjects. |
| EqualContents | 2つの SerializedProperty が等しいかどうかを確認します。 |