How to overwrite Width and Height values that are driven by a Layout Group in runtime.


  • I am adding items dynamically into a Layout Group and I cannot set a correct Spacing.
  • I cannot modify the Width and Height values since they are grayed out and they are driven by Layout Group.


When UI items are children of a parent GameObject that has a Layout Group component, this component prevents the Width and Height properties of the UI Items from being modified via the Inspector, in order to be driven by the Layout Group in runtime.


You can override the Width and Height values by adding a Layout Element component in your item. Next, override automatic values set by the Layout Group with the values that you need.

More Information

This article applies to Unity versions 5.0+

Was this article helpful?
1 out of 1 found this helpful
Have more questions? Submit a request


Please sign in to leave a comment.