How do I shrink a Response Button Template?

Announcements, support questions, and discussion for the Dialogue System.
AoF
Posts: 241
Joined: Sun May 12, 2019 8:36 pm

How do I shrink a Response Button Template?

Post by AoF »



The Response Button Template is too large for me (vertical space), but whenever I try to make it smaller, Unity puts it back to where it was. I think this is because of layouts, but I can't figure out which component is setting the size.

Hierarchy:

Content:

Response Button Template:

Response Text:

I would have assumed this is controlled by the Layout Element, but changing the Min Height has no effect.
User avatar
Tony Li
Posts: 22104
Joined: Thu Jul 18, 2013 1:27 pm

Re: How do I shrink a Response Button Template?

Post by Tony Li »

If you don't expect to have more than 5 responses at any given time, the easiest way to set it up is to turn off the scroll rect:

1. Inspect Response Menu Panel. Deactivate the Scroll Rect component.

2. Inspect Content. Change the Rect Transform to this:

mgfContent.png
mgfContent.png (18 KiB) Viewed 1612 times
AoF
Posts: 241
Joined: Sun May 12, 2019 8:36 pm

Re: How do I shrink a Response Button Template?

Post by AoF »

I think it's more likely than not that I'll have more than 5 and will need to use that scrollbar. I think that already comes up a at least once in my current code.

Is there a way to shrink them if I still want to use a scroll bar?
User avatar
Tony Li
Posts: 22104
Joined: Thu Jul 18, 2013 1:27 pm

Re: How do I shrink a Response Button Template?

Post by Tony Li »

Actually that's exactly the same. Just re-enable the Scroll Rect.
AoF
Posts: 241
Joined: Sun May 12, 2019 8:36 pm

Re: How do I shrink a Response Button Template?

Post by AoF »

That in it of itself did not make the content smaller. It just seemed to move it to the bottom:

User avatar
Tony Li
Posts: 22104
Joined: Thu Jul 18, 2013 1:27 pm

Re: How do I shrink a Response Button Template?

Post by Tony Li »

Oh, I thought you wanted to make the entire response menu panel smaller. Sorry I didn't read that correctly.

Check the Response Text. If it has a Layout Element, you may need to reduce its Min Height.

Then check the same for Response Button Template.

Finally, check the Content's Vertical Layout Group. Make sure Child Force Expand > Height is not ticked, since this may try to make the content tall enough to fill out the entire viewport height.
AoF
Posts: 241
Joined: Sun May 12, 2019 8:36 pm

Re: How do I shrink a Response Button Template?

Post by AoF »

Unless I'm misunderstanding something, I think my pictures show it already doing all those things. Reducing the layout group's min height makes no difference.
User avatar
Tony Li
Posts: 22104
Joined: Thu Jul 18, 2013 1:27 pm

Re: How do I shrink a Response Button Template?

Post by Tony Li »

What if you untick the Response Button Template's Vertical Layout Group > Force Expand > Height checkbox?

You might just need to play around with it. Feel free to send me a copy of the UI if you'd like me to take a look and see if I can find settings that make the buttons less tall.
User avatar
Tony Li
Posts: 22104
Joined: Thu Jul 18, 2013 1:27 pm

Re: How do I shrink a Response Button Template?

Post by Tony Li »

In the end, the key was to untick the Content GameObject's Vertical Layout Group > Control Child Size.
AoF
Posts: 241
Joined: Sun May 12, 2019 8:36 pm

Re: How do I shrink a Response Button Template?

Post by AoF »

Tony Li wrote: Sun Aug 25, 2019 4:28 pm In the end, the key was to untick the Content GameObject's Vertical Layout Group > Control Child Size.
Of course (???)!

I know this is more about Unity and your library, but does that make sense to you? I've been trying to learn how Unity layout works ever since I started learning Unity, and have never found a thorough resource. If you happen to know of one, I'd love to read it. I've always been confused by Content Layouts.
Post Reply