UnityEditor.SerializedObject.FindProperty C# (CSharp) Method

FindProperty() public method

Find serialized property by name.

public FindProperty ( string propertyPath ) : UnityEditor.SerializedProperty
propertyPath string
return UnityEditor.SerializedProperty
        public SerializedProperty FindProperty(string propertyPath)
        {
            SerializedProperty property = this.GetIterator_Internal();
            property.m_SerializedObject = this;
            if (property.FindPropertyInternal(propertyPath))
            {
                return property;
            }
            return null;
        }

Usage Example

    public void OnEnable()
    {
        disableBehaviour = new SerializedObject(this.target);
        this.fireTime = disableBehaviour.FindProperty("firetime");
        this.componentsProperty = disableBehaviour.FindProperty("Behaviour");
        this.editorRevert = disableBehaviour.FindProperty("editorRevertMode");
        this.runtimeRevert = disableBehaviour.FindProperty("runtimeRevertMode");
        Component currentComponent = componentsProperty.objectReferenceValue as Component;

        DisableBehaviour behaviour = (target as DisableBehaviour);
        if (behaviour == null || behaviour.ActorTrackGroup == null || behaviour.ActorTrackGroup.Actor == null)
        {
            return;
        }
        GameObject actor = behaviour.ActorTrackGroup.Actor.gameObject;

        Component[] behaviours = DirectorHelper.getEnableableComponents(actor);
        for (int j = 0; j < behaviours.Length; j++)
        {
            if (behaviours[j] == currentComponent)
            {
                componentSelection = j;
            }
        }
    }
All Usage Examples Of UnityEditor.SerializedObject::FindProperty