pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: https://docs.unity3d.com/ScriptReference/../Manual/../ScriptReference/EditorGUI.IntPopup.html

er: { user_unity_id: undefined, user_logged_in: 'no' }, environment: { environment_locale: 'en-us', environment_currency: undefined }}); Unity - Scripting API: EditorGUI.IntPopup
Version: Unity 6.5 (6000.5)
LanguageEnglish
  • C#

EditorGUI.IntPopup

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Declaration

public static int IntPopup(Rect position, int selectedValue, string[] displayedOptions, int[] optionValues, GUIStyle style = EditorStyles.popup);

Declaration

public static int IntPopup(Rect position, int selectedValue, GUIContent[] displayedOptions, int[] optionValues, GUIStyle style = EditorStyles.popup);

Declaration

public static int IntPopup(Rect position, string label, int selectedValue, string[] displayedOptions, int[] optionValues, GUIStyle style = EditorStyles.popup);

Declaration

public static int IntPopup(Rect position, GUIContent label, int selectedValue, GUIContent[] displayedOptions, int[] optionValues, GUIStyle style = EditorStyles.popup);

Parameters

Parameter Description
position Rectangle on the screen to use for the field.
label Optional label in front of the field.
selectedValue The value of the option the field shows.
displayedOptions An array with the displayed options the user can choose from.
optionValues An array with the values for each option. If optionValues a direct mapping of selectedValue to displayedOptions is assumed.
style Optional GUIStyle.

Returns

int The value of the option that has been selected by the user.

Description

Makes an integer popup selection field.

Takes the currently selected integer as a parameter and returns the integer selected by the user.


Int Popup in an Editor Window.

using UnityEngine;
using UnityEditor;

// Multiplies the scale of the selected transform.

class EditorGUIIntPopup : EditorWindow { int selectedSize = 1; string[] names = { "Double", "Triple", "Quadruple" }; int[] sizes = { 2, 3, 4 };

[MenuItem("Examples/Editor GUI Int Popup usage")] static void Init() { EditorWindow window = GetWindow<EditorGUIIntPopup>(); window.position = new Rect(0, 0, 180, 60); window.Show(); }

void OnGUI() { selectedSize = EditorGUI.IntPopup( new Rect(3, 3, position.width - 6, 20), "Size:", selectedSize, names, sizes);

if (GUI.Button(new Rect(0, 25, position.width, position.height - 27), "Modify")) { Rescale(); } }

void Rescale() { if (Selection.activeTransform) { Selection.activeTransform.localScale *= selectedSize; } else { Debug.LogError("No Object selected, please select an object to scale."); } } }

Declaration

public static void IntPopup(Rect position, SerializedProperty property, GUIContent[] displayedOptions, int[] optionValues, GUIContent label = null);

Parameters

Parameter Description
position Rectangle on the screen to use for the field.
property The SerializedProperty to use for the control.
displayedOptions An array with the displayed options the user can choose from.
optionValues An array with the values for each option. If optionValues a direct mapping of selectedValue to displayedOptions is assumed.
label Optional label in front of the field.

Description

pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy