Author Topic: How to restrict a UIWidget's minimum size?  (Read 1607 times)

leagueofmonkeys

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 20
    • View Profile
How to restrict a UIWidget's minimum size?
« on: October 22, 2015, 05:28:48 PM »
Hi, I have a UIWidget anchored to a UILabel and I would like the UIWidget to never go below a minimum height or width.  How can I acheive this?

Thanks :)

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: How to restrict a UIWidget's minimum size?
« Reply #1 on: October 24, 2015, 04:39:08 AM »
  1. using UnityEngine;
  2.  
  3. public class MyCustomWidget : UIWidget
  4. {
  5.         /// <summary>
  6.         /// Minimum allowed width for this widget.
  7.         /// </summary>
  8.  
  9.         override public int minWidth { get { return 200; } }
  10.  
  11.         /// <summary>
  12.         /// Minimum allowed height for this widget.
  13.         /// </summary>
  14.  
  15.         override public int minHeight { get { return 200; } }
  16. }
...overwrite "200" with whatever value you need.

leagueofmonkeys

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 20
    • View Profile
Re: How to restrict a UIWidget's minimum size?
« Reply #2 on: October 25, 2015, 05:23:53 PM »
Thanks ArenMook :)