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 は主に SerializedObject と Editor クラスを組み合わせて使用します。 参照: 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 | アニメーションカーブのプロパティーの値 |
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 プロパティーの値 |
colorValue | color プロパティーの値 |
depth | プロパティーのネストの深さ (読み取り専用) |
displayName | 最適なプロパティーの表示名 (読み取り専用) |
doubleValue | double として float プロパティーの値 |
editable | プロパティーが編集可能かどうか (読み取り専用) |
enumDisplayNames | enum プロパティーの表示しやすい列挙型名 |
enumNames | enum プロパティーの列挙型名 |
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 プロパティーの値 |
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 | 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. |
managedReferenceValue | Sets the value of a managed reference. |
minArraySize | The smallest number of elements in the array across all target objects. (Read Only) |
name | プロパティー名 (読み取り専用) |
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 | プロパティーのタイプ名 (読み取り専用) |
vector2IntValue | Value of a 2D integer vector property. |
vector2Value | Vector2 プロパティーの値 |
vector3IntValue | Value of a 3D integer vector property. |
vector3Value | Vector3 プロパティーの値 |
vector4Value | Vector4 プロパティーの値 |
ClearArray | 配列からすべてのエレメントを削除します |
Copy | 現在の状態の SerializedProperty イテレーターのコピーを返し、現在のプロパティーへの参照を維持しますが、イテレーションを続行する場合に便利です。 |
CountInProperty | このプロパティー自体を含む、このプロパティーの Visible children (見えている子) をカウントします |
CountRemaining | 残りの Visible プロパティーをカウントします |
DeleteArrayElementAtIndex | 配列内の指定したインデックスにあるエレメントを削除します |
DeleteCommand | シリアライズされたプロパティーを削除します |
DuplicateCommand | シリアライズされたプロパティーを複製します |
FindPropertyRelative | 現在のプロパティーへの相対パスで SerializedProperty を取得してきます |
GetArrayElementAtIndex | 配列内の指定したインデックスにあるエレメントを返します |
GetEndProperty | このプロパティーの範囲の終わりを定義する SerializedProperty を取得します |
GetEnumerator | 現在のシリアライズされたプロパティーの Next() を反復処理するイテレータを取得します |
GetFixedBufferElementAtIndex | Returns the element at the specified index in the fixed buffer. |
InsertArrayElementAtIndex | 空のエレメントを配列内の指定したインデックスに挿入します |
MoveArrayElement | srcIndex から dstIndex に配列エレメントを移動します |
Next | 次のプロパティーに移動します |
NextVisible | 次の Visible プロパティーに移動します |
Reset | オブジェクトの最初のプロパティーに移動します |
DataEquals | Compares the data for two SerializedProperties. This method ignores paths and SerializedObjects. |
EqualContents | 2つの SerializedProperty が等しいかどうかを確認します。 |
Did you find this page useful? Please give it a rating:
Thanks for rating this page!
What kind of problem would you like to report?
Thanks for letting us know! This page has been marked for review based on your feedback.
If you have time, you can provide more information to help us fix the problem faster.
Provide more information
You've told us this page needs code samples. If you'd like to help us further, you could provide a code sample, or tell us about what kind of code sample you'd like to see:
You've told us there are code samples on this page which don't work. If you know how to fix it, or have something better we could use instead, please let us know:
You've told us there is information missing from this page. Please tell us more about what's missing:
You've told us there is incorrect information on this page. If you know what we should change to make it correct, please tell us:
You've told us this page has unclear or confusing information. Please tell us more about what you found unclear or confusing, or let us know how we could make it clearer:
You've told us there is a spelling or grammar error on this page. Please tell us what's wrong:
You've told us this page has a problem. Please tell us more about what's wrong:
Thank you for helping to make the Unity documentation better!
Your feedback has been submitted as a ticket for our documentation team to review.
We are not able to reply to every ticket submitted.