Hey Tony,
I am attempting to create a trivia minigame with a version of the SMS dialogue UI but I'm having an issue where the answers are cut off due to being too long. Is there a way to put responses on separate lines instead of one?. If possible, I wanted to make 2 answers on each line. (screenshots attached).
Create multiple response buttons in order for SMS
-
- Posts: 54
- Joined: Mon Jun 21, 2021 7:48 pm
Create multiple response buttons in order for SMS
- Attachments
-
- Trivia2.PNG (14.71 KiB) Viewed 1051 times
-
- Trivia1.PNG (15.84 KiB) Viewed 1051 times
Re: Create multiple response buttons in order for SMS
Hi,
The SMS Dialogue UI prefab's Response Panel has a Horizontal Layout Group, which lays out the response buttons horizontally.
You can replace this with a Vertical Layout Group to lay out the buttons vertically.
The Unity UI tutorial on raywenderlich.com is really helpful if you need an introduction to Unity UI layout.
The SMS Dialogue UI prefab's Response Panel has a Horizontal Layout Group, which lays out the response buttons horizontally.
You can replace this with a Vertical Layout Group to lay out the buttons vertically.
The Unity UI tutorial on raywenderlich.com is really helpful if you need an introduction to Unity UI layout.
-
- Posts: 54
- Joined: Mon Jun 21, 2021 7:48 pm
Re: Create multiple response buttons in order for SMS
Thanks Tony, that did it! Is there also a way to randomize the order of the responses? I tried a couple ways with RandomizeNextEntry() and x = math.random() but I couldn't get it to work right.
Re: Create multiple response buttons in order for SMS
You can shuffle the responses in an OnConversationResponseMenu() method on a script on the Dialogue Manager. Example:
Code: Select all
void OnConversationResponseMenu(Response[] responses)
{
for (int i = 0; i < responses.Length - 1; i++)
{
int j = Random.Range(i, responses.Length);
Response temp = responses[i];
responses[i] = responses[j];
responses[j] = temp;
}
}
-
- Posts: 54
- Joined: Mon Jun 21, 2021 7:48 pm
Re: Create multiple response buttons in order for SMS
Perfect, super helpful as always Tony, thanks!
Re: Create multiple response buttons in order for SMS
Glad to help!