ドキュメント

Unity Engine

Unity Engine

FindProperty(string)

Find serialized property by name.
読み終わるまでの所要時間 1 分最終更新 1ヶ月前

Definition

  • Type: Method
  • Namespace: UnityEditor
  • Assembly: UnityEditor.CoreModule
public SerializedProperty FindProperty(string propertyPath)

Parameters

propertyPath

Returns

Type

Description

SerializedProperty

Remarks

You can use this to find a specific property in the target object.

Examples

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); }}