添加了编辑器下的组件立刻更新模式

This commit is contained in:
2026-06-28 20:46:28 +08:00
parent 6c0478dc42
commit c98503239f
3 changed files with 64 additions and 7 deletions
+20 -3
View File
@@ -54,13 +54,30 @@ namespace XericUI.OverrideUI
{
base.OnEnable();
RevalidateStyles();
StyleRefreshManager.Register(this);
ApplyForState(m_CurrentState);
}
#if UNITY_EDITOR
protected override void OnValidate()
{
base.OnValidate();
RevalidateStyles();
ApplyForState(m_CurrentState);
}
#endif
private void RevalidateStyles()
{
m_ColorState?.UnsubscribeAll(OnStyleChanged);
m_TextureState?.UnsubscribeAll(OnStyleChanged);
m_ColorState?.RegisterAll();
m_TextureState?.RegisterAll();
m_ColorState?.SubscribeAll(OnStyleChanged);
m_TextureState?.SubscribeAll(OnStyleChanged);
StyleRefreshManager.Register(this);
ApplyForState(m_CurrentState);
}
protected override void OnDisable()