Unity UI – Auto scaling grid layout code

Unity UI – Auto scaling grid layout code

By December 8, 2014 Tools No Comments

Hey everyone,

I’ve been working on some new UI elements for one of my projects and noticed that the standard UGUI grid layout system didn’t give me the option to auto-scale the children content given a fixed row or column amount. So I extended the GridLayoutGroup and modified it to automatically fit its contents within either a Row or Column constraint.

LayoutPanelUsage

Simply install the package, add the Auto Grid Component and tweak the variables. The component will then automatically resize its children to fit within its bounds.

License

You can use this code in any project you wish, free of charge and without needing to reference us in any way.

Get the code

Download the Unity Package is here.

Thanks – Danny