Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: leagueofmonkeys on October 22, 2015, 05:28:48 PM

Title: How to restrict a UIWidget's minimum size?
Post by: leagueofmonkeys 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 :)
Title: Re: How to restrict a UIWidget's minimum size?
Post by: ArenMook 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.
Title: Re: How to restrict a UIWidget's minimum size?
Post by: leagueofmonkeys on October 25, 2015, 05:23:53 PM
Thanks ArenMook :)