fix(UI): 修复当UIBase的IsOpenOnFirstLoad为false的时候,会导致组件的Awake无法触发的BUG

This commit is contained in:
2025-10-19 19:42:55 +08:00
parent f3d73ab65a
commit bc6e0277f8
3 changed files with 7 additions and 6 deletions

View File

@@ -10,6 +10,12 @@ namespace Core
public abstract class UIBase : MonoBehaviour
{
public bool IsOpenOnFirstLoad;
protected virtual void Awake()
{
if (!IsOpenOnFirstLoad) Hide();
}
/// <summary>
/// Called when the UI is shown.
/// </summary>

View File

@@ -48,11 +48,6 @@ namespace Core
if (uiBase != null && !openedUIs.ContainsKey(uiName))
{
openedUIs[uiName] = uiBase;
uiBase.Hide(); // 默认关闭
if (uiBase.IsOpenOnFirstLoad)
{
uiBase.Show();
}
}
}
}