Support => NGUI 3 Support => Topic started by: viqtor on August 10, 2014, 01:36:40 PM
Title: Grid dimensions
Post by: viqtor on August 10, 2014, 01:36:40 PM
Hello
I want to combine a grid/table and a widget together, the widget can be aligned relative to other objects and the grid/table updates the cell dimensions according to the widget. What is the easiest way to do it? I wonder why nobody asked that before.
Title: Re: Grid dimensions
Post by: ArenMook on August 10, 2014, 06:09:03 PM
You'll need to write a script for that. Knowing the width and height of the widget, set the grid's cell width accordingly. For example:
usingUnityEngine;
publicclass ResizeMyGrid : MonoBehaviour
{
public UIGrid grid;
public UIWidget widget;
void Start (){ widget.onChange= ChangeMyGrid;}
void ChangeMyGrid ()
{
grid.cellSize= widget.width/4;
grid.Reposition();
}
}
Title: Re: Grid dimensions
Post by: viqtor on August 11, 2014, 06:36:30 AM
Thanks, I will write a complete script and get back to you.