Exemple #1
0
        public static void DeleteArrayElement(object userData)
        {
            RuntimeSerializedProperty runtimeSerializedProperty = userData as RuntimeSerializedProperty;

            runtimeSerializedProperty.DeleteCommand();
            EditorUtilityHelper.ForceReloadInspectors();
        }
Exemple #2
0
        public static void EndProperty()
        {
            EditorGUI.showMixedValue = false;
            RuntimePropertyGUIData data = s_PropertyStack.Pop();

            // Context menu
            // Handle context menu in EndProperty instead of BeginProperty. This ensures that child properties
            // get the event rather than parent properties when clicking inside the child property rects, but the menu can
            // still be invoked for the parent property by clicking inside the parent rect but outside the child rects.
            if (Event.current.type == EventType.ContextClick && data.TotalPosition.Contains(Event.current.mousePosition))
            {
                DoPropertyContextMenu(data.Property);
            }

            EditorGUIUtilityHelper.SetBoldDefaultFont(data.WasBoldDefaultFont);
            GUI.enabled         = data.WasEnabled;
            GUI.backgroundColor = data.Color;

            if (s_PendingPropertyKeyboardHandling != null)
            {
                DoPropertyFieldKeyboardHandling(s_PendingPropertyKeyboardHandling);
            }

            // Wait with deleting the property until the property stack is empty in order to avoid
            // deleting a property in the middle of GUI calls that's dependent on it existing.
            if (s_PendingPropertyDelete != null && s_PropertyStack.Count == 0)
            {
                // For SerializedProperty iteration reasons, if the property we delete is the current property,
                // we have to delete on the actual iterator property rather than a copy of it,
                // otherwise we get an error next time we call NextVisible on the iterator property.
                if (s_PendingPropertyDelete.PropertyPath == data.Property.PropertyPath)
                {
                    data.Property.DeleteCommand();
                }
                else
                {
                    s_PendingPropertyDelete.DeleteCommand();
                }
                s_PendingPropertyDelete = null;
            }
        }