SerializedObject と SerializedProperty は自動的に Undo とプレハブの UI のスタイリングを処理する一般的な方法でオブジェクトのプロパティーを編集するクラスです。
SerializedObject は SerializedProperty と Editor クラスと組み合わせて使用します。
関連項目: SerializedProperty クラス、 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);
UnityEditor.SerializedProperty serializedPropertyMyInt = serializedObject.FindProperty("myInt");
Debug.Log("myInt " + serializedPropertyMyInt.intValue); } }
| context | The context used to store and resolve ExposedReference types. This is set by the SerializedObject constructor. |
| isEditingMultipleObjects | シリアライズされたオブジェクトは複数のオブジェクトを編集するために表すかどうか(Read Only) |
| maxArraySizeForMultiEditing | Defines the maximum size beyond which arrays cannot be edited when multiple objects are selected. |
| targetObject | 検査されるオブジェクト (Read Only) |
| targetObjects | 検査されるオブジェクト (Read Only) |
| SerializedObject | 検査されるオブジェクトの SerializedObject を作成します |
| ApplyModifiedProperties | プロパティーの変更を適用します |
| ApplyModifiedPropertiesWithoutUndo | Undo 操作を登録することなしでプロパティーの変更を適用します。 |
| CopyFromSerializedProperty | Copies a value from a SerializedProperty to the corresponding serialized property on the serialized object. |
| CopyFromSerializedPropertyIfDifferent | Copies a changed value from a SerializedProperty to the corresponding serialized property on the serialized object. |
| FindProperty | プロパティー名から SerializedProperty を取得します |
| GetIterator | 1つ目のシリアライズ化されたプロパティーを取得します |
| SetIsDifferentCacheDirty | 次の /Update()/ 呼び出しの hasMultipleDifferentValues キャッシュを更新します |
| Update | シリアライズされたオブジェクトの形式を更新します |
| UpdateIfRequiredOrScript | 最後のUpdateの呼び出しやスクリプトを実行した後の場合で、オブジェクトが変更されたときにのみ、シリアライズされたオブジェクトの表示を更新します。 |