UnityEditor.EditorGUILayout.IntPopup C# (CSharp) Method

IntPopup() public static method

Make an integer popup selection field.

public static IntPopup ( GUIContent label, int selectedValue, GUIContent displayedOptions, int optionValues ) : int
label UnityEngine.GUIContent Optional label in front of the field.
selectedValue int The value of the option the field shows.
displayedOptions UnityEngine.GUIContent An array with the displayed options the user can choose from.
optionValues int An array with the values for each option.
return int
        public static int IntPopup(GUIContent label, int selectedValue, GUIContent[] displayedOptions, int[] optionValues, params GUILayoutOption[] options)
        {
            return IntPopup(label, selectedValue, displayedOptions, optionValues, EditorStyles.popup, options);
        }

Same methods

EditorGUILayout::IntPopup ( GUIContent label, int selectedValue, GUIContent displayedOptions, int optionValues, GUIStyle style ) : int
EditorGUILayout::IntPopup ( int selectedValue, GUIContent displayedOptions, int optionValues ) : int
EditorGUILayout::IntPopup ( int selectedValue, GUIContent displayedOptions, int optionValues, GUIStyle style ) : int
EditorGUILayout::IntPopup ( int selectedValue, string displayedOptions, int optionValues ) : int
EditorGUILayout::IntPopup ( int selectedValue, string displayedOptions, int optionValues, GUIStyle style ) : int
EditorGUILayout::IntPopup ( string label, int selectedValue, string displayedOptions, int optionValues ) : int
EditorGUILayout::IntPopup ( string label, int selectedValue, string displayedOptions, int optionValues, GUIStyle style ) : int
EditorGUILayout::IntPopup ( UnityEditor.SerializedProperty property, GUIContent displayedOptions, int optionValues ) : void
EditorGUILayout::IntPopup ( UnityEditor.SerializedProperty property, GUIContent displayedOptions, int optionValues, GUIContent label ) : void
EditorGUILayout::IntPopup ( UnityEditor.SerializedProperty property, GUIContent displayedOptions, int optionValues, GUIContent label, GUIStyle style ) : void

Usage Example

        public override void OnInspectorGUI()
        {
            if (m_Images == null)
            {
                InitTexturesFromCubemap();
            }

            EditorGUIUtility.labelWidth = 50;
            var c = target as Cubemap;

            if (c == null)
            {
                return;
            }

            GUILayout.BeginVertical();

            GUILayout.BeginHorizontal();
            ShowFace("Right\n(+X)", CubemapFace.PositiveX);
            ShowFace("Left\n(-X)", CubemapFace.NegativeX);
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            ShowFace("Top\n(+Y)", CubemapFace.PositiveY);
            ShowFace("Bottom\n(-Y)", CubemapFace.NegativeY);
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            ShowFace("Front\n(+Z)", CubemapFace.PositiveZ);
            ShowFace("Back\n(-Z)", CubemapFace.NegativeZ);
            GUILayout.EndHorizontal();

            GUILayout.EndVertical();

            EditorGUIUtility.labelWidth = 0;

            EditorGUILayout.Space();

            EditorGUI.BeginChangeCheck();

            EditorGUILayout.HelpBox("Lowering face size is a destructive operation, you might need to re-assign the textures later to fix resolution issues. It's preferable to use Cubemap texture import type instead of Legacy Cubemap assets.", MessageType.Warning);
            int faceSize = TextureUtil.GetGPUWidth(c);

            faceSize = EditorGUILayout.IntPopup("Face size", faceSize, kSizes, kSizesValues);

            int  mipMaps   = TextureUtil.GetMipmapCount(c);
            bool useMipMap = EditorGUILayout.Toggle("MipMaps", mipMaps > 1);

            bool streamingMipmaps = TextureUtil.GetCubemapStreamingMipmaps(c);

            if (useMipMap)
            {
                streamingMipmaps = EditorGUILayout.Toggle(EditorGUIUtility.TrTextContent("Streaming Mip Maps", "Don't load image data immediately, but wait till image data is requested from script."), streamingMipmaps);
            }

            bool linear = TextureUtil.GetLinearSampled(c);

            linear = EditorGUILayout.Toggle("Linear", linear);

            bool readable = TextureUtil.IsCubemapReadable(c);

            readable = EditorGUILayout.Toggle("Readable", readable);

            if (EditorGUI.EndChangeCheck())
            {
                // reformat the cubemap
                if (TextureUtil.ReformatCubemap(ref c, faceSize, faceSize, c.format, useMipMap, linear))
                {
                    InitTexturesFromCubemap();
                }

                TextureUtil.MarkCubemapReadable(c, readable);
                TextureUtil.SetCubemapStreamingMipmaps(c, streamingMipmaps);
                c.Apply();
            }
        }
All Usage Examples Of UnityEditor.EditorGUILayout::IntPopup