Skip to content

Instantly share code, notes, and snippets.

@QuantumCalzone
QuantumCalzone / LayoutElementExtended.cs
Last active April 1, 2021 23:08
An extension of Unity's LayoutElement script that enable more flexible adaptation such as matching another RecTransform's dimensions or setting maximum preferred values. Put the Inspector and Property Drawer scripts in an Editor folder. Also available as a package at https://github.com/QuantumCalzone/UnityLayoutElementExtended
using UnityEngine;
using UnityEngine.UI;
namespace QuantumCalzone
{
[AddComponentMenu("Layout/Extended/Layout Element Extended")]
[RequireComponent(typeof(RectTransform))]
public class LayoutElementExtended : LayoutElement
{
public LayoutElementExtendedValue MinWidthExtended = new LayoutElementExtendedValue();