Author Topic: Scrolling panel with simple text  (Read 4501 times)

kruncher

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 78
    • View Profile
Scrolling panel with simple text
« on: October 20, 2013, 10:21:56 AM »
I have created a simple scroll view which has a vertical scrollbar, a scroll panel which contains a simple label. The label has a collider and the "UIDrag Panel Contents" script attached.

The text of the label changes throughout play, but the collider doesn't update to reflect the size of the text.

What is the best way to keep the collider size sufficiently large so that the content can be dragged? or... should I just make the collider very large to begin with?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Scrolling panel with simple text
« Reply #1 on: October 20, 2013, 06:06:08 PM »
Set up your label with Wrap or Shrink Content instead of Resize. This way its dimensions will be fixed to begin with.

kruncher

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 78
    • View Profile
Re: Scrolling panel with simple text
« Reply #2 on: October 20, 2013, 06:14:40 PM »
I have specified "Resize Height" for my label since it grows as things are logged. So yeah the width is certainly fixed, though the height will gradually increase.
  1. if (logLabel.text != "")
  2.     logLabel.text += "\n";
  3. logLabel.text += "Something happened!";
  4.