Using dropdown + Scroll view

I’ve set up dropdown and a scroll view in my UI and I want the player to be able to click the dropdown to select a list of options to appear in the scroll view.

So the options are categorized by the dropdown and then the actual options are in the scroll view.

Example:

Dropdown options: “Ask a question”, “Gossip”, “Threaten”

If you click “Ask a question” you get these options in the scroll view: “What day is it?”, “Who are you?”, “Do you have a little brother?”

I’m not sure where to start. Can anyone push me in the right direction? Thanks.

When you create a dropdown, go to the dropdown, then go to the dropdown script.
There you can see an “options” section. in there you can write down your options.

In the children of the Dropdown object, you can find “Label”, just change the text of the label to “Ask a question”.

Heya @bjarnidk

Scroll View is really more of a container of other elements, so you’ll need to decide what you want you the options in the scroll view to be. Buttons? Text? Make sure you put those elements in the scroll view.

The easiest way to get this running is to make a submit button. Make a function that gets your dropdown input and sets the button labels or text accordingly, and assign that function to the OnClick of the button.

Get Value: Dropdown.value
https://docs.unity3d.com/ScriptReference/UI.Dropdown-value.html

Set Text: Text.text
https://docs.unity3d.com/ScriptReference/UI.Text-text.html

Hopefully that is a start!