UnityEditor.EditorGUILayout.PropertyField C# (CSharp) Method

PropertyField() public static method

Make a field for SerializedProperty.

public static PropertyField ( UnityEditor.SerializedProperty property ) : bool
property UnityEditor.SerializedProperty The SerializedProperty to make a field for.
return bool
        public static bool PropertyField(SerializedProperty property, params GUILayoutOption[] options)
        {
            return PropertyField(property, null, false, options);
        }

Same methods

EditorGUILayout::PropertyField ( UnityEditor.SerializedProperty property, GUIContent label ) : bool
EditorGUILayout::PropertyField ( UnityEditor.SerializedProperty property, GUIContent label, bool includeChildren ) : bool
EditorGUILayout::PropertyField ( UnityEditor.SerializedProperty property, bool includeChildren ) : bool

Usage Example

        void DrawActionButtonArrayElement(SP dialog, int elementIndex)
        {
            DrawArrayElement(dialog, elementIndex, "Consent dialog should have at least 1 button.", MinActionButtonsCount,
                             () => SelectedButtonIndex,
                             param => SelectedButtonIndex = param,
                             obj =>
            {
                var title = obj.FindPropertyRelative("title");

                EditorGUI.indentLevel++;
                string key = obj.propertyPath;

                if (!privacyFoldoutStates.ContainsKey(key))
                {
                    privacyFoldoutStates.Add(key, false);
                }

                string titleValue         = !string.IsNullOrEmpty(title.stringValue) ? title.stringValue : "[Untitled Button]";
                privacyFoldoutStates[key] = EGL.Foldout(privacyFoldoutStates[key], titleValue, true);
                EditorGUI.indentLevel--;

                if (privacyFoldoutStates[key])
                {
                    EGL.PropertyField(obj.FindPropertyRelative("id"));
                    EGL.PropertyField(title);
                    EGL.PropertyField(obj.FindPropertyRelative("interactable"));
                    EGL.PropertyField(obj.FindPropertyRelative("titleColor"));
                    EGL.PropertyField(obj.FindPropertyRelative("backgroundColor"));
                    EGL.PropertyField(obj.FindPropertyRelative("uninteractableTitleColor"));
                    EGL.PropertyField(obj.FindPropertyRelative("uninteractableBackgroundColor"));
                }
            });
        }
All Usage Examples Of UnityEditor.EditorGUILayout::PropertyField