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.
void AddOptions (string[] options) void AddOptions (Table options) void AddOptions ([] optionsSprites)
Add multiple options to the options of the Dropdown.
void ClearOptions ()
Clear the list of options in the Dropdown.
void Show ()
Show the dropdown list.
void Hide ()
Hide the dropdown list.
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.
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.
bool Interactable get set
Is this UIDropdown interactable?
Template get set
The Rect Transform of the template for the dropdown list.
CaptionText get set
The Text component to hold the text of the currently selected option.
CaptionImage get set
The Image component to hold the image of the currently selected option.
ItemText get set
The Text component to hold the text of the item.
ItemImage get set
The Image component to hold the image of the item.
string[] OptionsAsText get
The list of possible options. (Text)
[] OptionsAsSprites get
The list of possible options. (Sprites)
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 get set
Property Description
HighlightedColor get set
Property Description
PressedColor get set
Property Description
DisabledColor get set
Property Description
float ColorMultiplier get set
Property Description
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
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 = aReferenceToAGameObjectcaptionText = Space.Host.ExecutingObject.UIDropdown.CaptionText
captionText.Text = "new caption"aReferenceToAGameObject = Space.Host.GetReference("reference name")
Space.Host.ExecutingObject.UIDropdown.CaptionImage = aReferenceToAGameObject.UIImageaReferenceToAGameObject = Space.Host.GetReference("reference name")
Space.Host.ExecutingObject.UIDropdown.CaptionImage = aReferenceToAGameObject.UITextiaReferenceToAGameObject = Space.Host.GetReference("reference name")
Space.Host.ExecutingObject.UIDropdown.CaptionImage = aReferenceToAGameObject.UIImageoptionsText = Space.Host.ExecutingObject.UIDropdown.OptionsAsTextoptionsSprites = Space.Host.ExecutingObject.UIDropdown.OptionsAsSpritesSpace.Host.ExecutingObject.UIDropdown.Value= 2Space.Host.ExecutingObject.UIDropdown.NormalColor = Color.RedSpace.Host.ExecutingObject.UIDropdown.HighlightedColor = Color.RedSpace.Host.ExecutingObject.UIDropdown.PressedColor = Color.RedSpace.Host.ExecutingObject.UIDropdown.DisabledColor = Color.RedSpace.Host.ExecutingObject.UIDropdown.ColorMultiplier = Color.RedSpace.Host.ExecutingObject.UIDropdown.GameObject = Color.Red