UnityEditor.AudioMixerEffectGUI.PopupButton C# (CSharp) Method

PopupButton() public static method

public static PopupButton ( GUIContent label, GUIContent buttonContent, GUIStyle style, Rect &buttonRect ) : bool
label UnityEngine.GUIContent
buttonContent UnityEngine.GUIContent
style UnityEngine.GUIStyle
buttonRect UnityEngine.Rect
return bool
        public static bool PopupButton(GUIContent label, GUIContent buttonContent, GUIStyle style, out Rect buttonRect, params GUILayoutOption[] options)
        {
            if (label != null)
            {
                Rect position = EditorGUILayout.s_LastRect = EditorGUILayout.GetControlRect(true, 16f, style, options);
                int id = GUIUtility.GetControlID("EditorPopup".GetHashCode(), FocusType.Keyboard, position);
                buttonRect = EditorGUI.PrefixLabel(position, id, label);
            }
            else
            {
                Rect rect2 = GUILayoutUtility.GetRect(buttonContent, style, options);
                buttonRect = rect2;
            }
            return EditorGUI.ButtonMouseDown(buttonRect, buttonContent, FocusType.Passive, style);
        }

Usage Example

示例#1
0
        public static void AssetPopup <T>(SerializedProperty serializedProperty, GUIContent label, string fileExtension, string defaultFieldName) where T : UnityEngine.Object, new()
        {
            bool showMixedValue = EditorGUI.showMixedValue;

            EditorGUI.showMixedValue = serializedProperty.hasMultipleDifferentValues;
            string     objectReferenceTypeString = serializedProperty.objectReferenceTypeString;
            GUIContent buttonContent;

            if (serializedProperty.hasMultipleDifferentValues)
            {
                buttonContent = EditorGUI.mixedValueContent;
            }
            else if (serializedProperty.objectReferenceValue != null)
            {
                buttonContent = GUIContent.Temp(serializedProperty.objectReferenceStringValue);
            }
            else
            {
                buttonContent = GUIContent.Temp(defaultFieldName);
            }
            Rect buttonRect;

            if (AudioMixerEffectGUI.PopupButton(label, buttonContent, EditorStyles.popup, out buttonRect, new GUILayoutOption[0]))
            {
                AssetPopupBackend.ShowAssetsPopupMenu <T>(buttonRect, objectReferenceTypeString, serializedProperty, fileExtension, defaultFieldName);
            }
            EditorGUI.showMixedValue = showMixedValue;
        }
All Usage Examples Of UnityEditor.AudioMixerEffectGUI::PopupButton