Rasagar/Library/PackageCache/com.unity.ugui/Editor/UGUI/UI/PrefabLayoutRebuilder.cs
2024-08-26 23:07:20 +03:00

25 lines
586 B
C#

using UnityEngine;
using UnityEngine.UI;
namespace UnityEditor.UI
{
[InitializeOnLoad]
internal class PrefabLayoutRebuilder
{
static PrefabLayoutRebuilder()
{
PrefabUtility.prefabInstanceUpdated += OnPrefabInstanceUpdates;
}
static void OnPrefabInstanceUpdates(GameObject instance)
{
if (instance)
{
RectTransform rect = instance.transform as RectTransform;
if (rect)
LayoutRebuilder.MarkLayoutForRebuild(rect);
}
}
}
}