All pages
Powered by GitBook
1 of 1

Loading...

SUIDropdown

Index

Functions Index

Function Name

Properties Index

Property Name

Functions

RefreshShownValue

void RefreshShownValue ()

Refreshes the text and image (if available) of the currently selected option.If you have modified the list of options, you should call this method afterwards to ensure that the visual state of the dropdown corresponds to the updated options.

Parameter
Type
Description

AddOptions

void AddOptions (string[] options) void AddOptions (Table options) void AddOptions ([] optionsSprites)

Add multiple options to the options of the Dropdown.

Parameter
Type
Description

ClearOptions

void ClearOptions ()

Clear the list of options in the Dropdown.

Show

void Show ()

Show the dropdown list.

Hide

void Hide ()

Hide the dropdown list.

OnValueChanged

void OnValueChanged (Closure callback)

Bind a function to handle the event that is invoked when when a user has clicked one of the options in the dropdown list.

Parameter
Type
Description

SetValueByText

bool SetValueByText (string text)

Attempts to set the dropdown to the first option in the dropdown list that matches the inputted text. Returns true if found, false if no matches found.

Parameter
Type
Description

Properties

Interactable

bool Interactable get set

Is this UIDropdown interactable?

Template

Template get set

The Rect Transform of the template for the dropdown list.

CaptionText

CaptionText get set

The Text component to hold the text of the currently selected option.

CaptionImage

CaptionImage get set

The Image component to hold the image of the currently selected option.

ItemText

ItemText get set

The Text component to hold the text of the item.

ItemImage

ItemImage get set

The Image component to hold the image of the item.

OptionsAsText

string[] OptionsAsText get

The list of possible options. (Text)

OptionsAsSprites

[] OptionsAsSprites get

The list of possible options. (Sprites)

Value

int Value get set

The Value is the index number of the current selection in the Dropdown. 0 is the first option in the Dropdown, 1 is the second, and so on.

NormalColor

NormalColor get set

Property Description

HighlightedColor

HighlightedColor get set

Property Description

PressedColor

PressedColor get set

Property Description

DisabledColor

DisabledColor get set

Property Description

ColorMultiplier

float ColorMultiplier get set

Property Description

GameObject

GameObject get

Property Description

SColor get set

SColor get set

SColor get set

float get set

SGameObject get

void RefreshShownValue ()

void AddOptions (string[] options) void AddOptions (Table options) void AddOptions (SResource[] optionsSprites)

void ClearOptions ()

void Show ()

void Hide ()

void OnValueChanged (Closure callback)

bool Interactable get set

SGameObject Template get set

SUIText CaptionText get set

SUIImage CaptionImage get set

SUIText ItemText get set

SUIImage ItemImage get set

string[] OptionsAsText get

SResource[] OptionsAsSprites get

int Value get set

SResource
SGameObject
SUIText
SUIImage
SUIText
SUIImage
SResource
SColor
SColor
SColor
SColor
SGameObject

SColor get set

Space.Host.ExecutingObject.UIDropdown.RefreshShownValue()
Space.Host.ExecutingObject.UIDropdown.AddOptions({"option1","option2","option3"})
Space.Host.ExecutingObject.UIDropdown.ClearOptions()
Space.Host.ExecutingObject.UIDropdown.Show()
Space.Host.ExecutingObject.UIDropdown.Hide()
function AFunction()
--
end

Space.Host.ExecutingObject.UIDropdown.OnValueChanged(AFunction)
Space.Host.ExecutingObject.UIDropdown.SetValueByText("Value Text")
--Populating a UIDropdown and making a selection using value's text
dropDown=Space.Host.GetReference("DropDown").UIDropdown
options = {"Room 1", "Room 2", "Room 3", "Room 4"}
dropDown.AddOptions(options)
dropDown.SetValueByText("Room 3")
Space.Host.ExecutingObject.UIDropdown.Interactable = true
--clicking this object will toggle a UIDropdown's interactable status

thisGameObject = Space.Host.ExecutingObject
dropdown = Space.Host.GetReference("dropdown").UIDropdown 
--make sure to add this reference to the Scripting Runtime component


OnClick = function()
dropdown.Interactable =  not dropdown.Interactable
end


thisGameObject.AddClickable()
thisGameObject.Clickable.OnClick(OnClick)
aReferenceToAGameObject = Space.Host.GetReference("reference name")
Space.Host.ExecutingObject.UIDropdown.Template = aReferenceToAGameObject
captionText = Space.Host.ExecutingObject.UIDropdown.CaptionText
captionText.Text = "new caption"
aReferenceToAGameObject = Space.Host.GetReference("reference name")
Space.Host.ExecutingObject.UIDropdown.CaptionImage = aReferenceToAGameObject.UIImage
aReferenceToAGameObject = Space.Host.GetReference("reference name")
Space.Host.ExecutingObject.UIDropdown.CaptionImage = aReferenceToAGameObject.UIText
iaReferenceToAGameObject = Space.Host.GetReference("reference name")
Space.Host.ExecutingObject.UIDropdown.CaptionImage = aReferenceToAGameObject.UIImage
optionsText = Space.Host.ExecutingObject.UIDropdown.OptionsAsText
optionsSprites = Space.Host.ExecutingObject.UIDropdown.OptionsAsSprites
Space.Host.ExecutingObject.UIDropdown.Value= 2
Space.Host.ExecutingObject.UIDropdown.NormalColor = Color.Red
Space.Host.ExecutingObject.UIDropdown.HighlightedColor = Color.Red
Space.Host.ExecutingObject.UIDropdown.PressedColor = Color.Red
Space.Host.ExecutingObject.UIDropdown.DisabledColor = Color.Red
Space.Host.ExecutingObject.UIDropdown.ColorMultiplier = Color.Red
Space.Host.ExecutingObject.UIDropdown.GameObject = Color.Red
NormalColor
HighlightedColor
PressedColor
DisabledColor
ColorMultiplier
GameObject