Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


FindProperty(string)

Find serialized property by name.
Read time 1 minuteLast updated 5 days ago

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