Skip to content

Instantly share code, notes, and snippets.

View JosephStar318's full-sized avatar

JosephStar318

  • 00:55 (UTC +03:00)
View GitHub Profile
@JosephStar318
JosephStar318 / LayoutRebuilder.cs
Last active February 25, 2026 12:46
A Solution to Unity's annoying layout groups that doesn't update itself properly after any child state change. This script adds LayoutRebuilder script to the game object whenever you create a layout group in the inspector and update layout groups whenever needed at runtime
using System.Collections;
using UnityEngine;
[DisallowMultipleComponent]
public class LayoutRebuilder : MonoBehaviour
{
private bool marked = false;
private RectTransform _rectTransform;
public RectTransform rectTransform
{