Inventool Quantity Prompt UGUI

🔢 InventoolQuantityPromptUGUI Class

A pop‑up element that prompts the user to confirm an action that requires a user‑defined quantity.

Namespace: Esper.Inventool.UI.UGUI Access: public Type: class Inherits: CrossInputSupportedWindowUGUI


📦 Fields

Access
Field
Type
Description

protected

minQuantity

float

The minimum quantity.

protected

maxQuantity

float

The maximum quantity.

protected

currentQuantity

float

The current quantity set by the user.

protected

hiddenCloseButton

Button

The full‑screen invisible close button.

protected

titleLabel

TextMeshProUGUI

The title label.

protected

targetGraphic

Image

The image of the target for the action.

protected

quantitySlider

Slider

The quantity slider.

protected

quantityField

TMP_InputField

The quantity input field.

protected

leftButton

Button

The left button option.

protected

rightButton

Button

The right button option.

protected

leftButtonIconImage

Image

Left button icon image.

protected

rightButtonIconImage

Image

Right button icon image.

protected

leftButtonLabel

TextMeshProUGUI

The left button label.

protected

rightButtonLabel

TextMeshProUGUI

The right button label.

protected

leftButtonAction

Action<float>

The left button on‑click action.

protected

rightButtonAction

Action<float>

The right button on‑click action.

protected

rightButtonTextSetter

Func<float, string>

A text setter for the right button label.

protected

quantityMode

QuantityMode

The quantity mode.


🔍 Properties

Access
Property
Type
Description

public static

Instance

InventoolQuantityPromptUGUI

The active instance.


🧰 Methods

Access
Method
Returns
Description

protected override

Awake()

void

Initializes singleton, wires buttons and handlers, sets up slider and input events, hides content.

public virtual

Open(string title, int minQuantity, int maxQuantity, Action<float> leftButtonAction = null, Action<float> rightButtonAction = null, bool showLeftButton = true, bool showRightButton = true, string leftButtonText = "Cancel", string rightButtonText = "Confirm", Sprite targetGraphic = null, Sprite leftButtonIcon = null, Sprite rightButtonIcon = null, Func<float, string> rightButtonTextSetter = null)

void

Opens with integer quantity mode; sets bounds, localization, icons, interactivity, and updates elements.

public virtual

Open(string title, float minQuantity, float maxQuantity, Action<float> leftButtonAction = null, Action<float> rightButtonAction = null, bool showLeftButton = true, bool showRightButton = true, string leftButtonText = "Cancel", string rightButtonText = "Confirm", Sprite targetGraphic = null, Sprite leftButtonIcon = null, Sprite rightButtonIcon = null, Func<float, string> rightButtonTextSetter = null)

void

Opens with float quantity mode; sets bounds, localization, icons, interactivity, and updates elements.

protected virtual

UpdateRightButtonText()

void

Updates the right button label via rightButtonTextSetter, if provided.

protected virtual

UpdateQuantityElements()

void

Syncs slider and input field with current quantity in the active mode; updates right button text.

public virtual

Close()

void

Closes the prompt, clears the right button text setter, and invokes onClosed.


🧩 Nested types

public enum QuantityMode

Name
Description

Integer

Quantity uses whole numbers.

Float

Quantity allows decimals.


Active Instance

You can get the active InventoolQuantityPromptUGUI instance with InventoolQuantityPromptUGUI.Instance. Ensure there's an instance of it in your scene before using this field.

Open

The Open method has many parameters you can use to customize what's displayed on the confirm prompt.

Name
Description
Type

title

The prompt title or the localized string key if you're using localization.

string

minQuantity

The minimum quantity.

float

maxQuantity

The maximum quantity.

float

leftButtonAction

The left button on-click action.

Action<float>

rightButtonAction

The right button on-click action.

Action<float>

showLeftButton

If the left button should be displayed.

bool

showRightButton

If the right button should be displayed.

bool

leftButtonText

The left button text or the localized string key if you're using localization.

string

rightButtonText

The right button text or the localized string key if you're using localization.

string

targetGraphic

A sprite that represents the target of the action.

Sprite

leftButtonIcon

The left button icon.

Sprite

rightButtonIcon

The right button icon.

Sprite

rightButtonTextSetter

The right button text setter.

Func<float, string>

// Open with range from 0 to 100
InventoolQuantityPromptUGUI.Instance.Open("My Title", 0, 100);

Close

InventoolQuantityPromptUGUI.Instance.Close();

Last updated