yyl
2026-03-04 bc1cb6da854cb2e9144f10ed55330a537ecdca16
Main/Component/UI/Common/UIPrefabLoader.cs
@@ -2,6 +2,7 @@
//    [Author]:           玩个游戏
//    [  Date ]:           Tuesday, March 19, 2019
//--------------------------------------------------------
using Cysharp.Threading.Tasks;
using UnityEngine;
[ExecuteAlways]
@@ -16,17 +17,17 @@
    [ExecuteAlways]
    private void Awake()
    {
        Create();
        Create().Forget();
    }
    public void Reload()
    {
        instance = null;
        this.transform.ClearAllChilds();
        Create();
        Create().Forget();
    }
    [ContextMenu("Create")]
    public virtual void Create()
    public virtual async UniTask Create()
    {
        if (instance != null)
            return;
@@ -40,7 +41,15 @@
            instance = find.gameObject;
            return;
        }
        instance = UIUtility.CreateWidget(prefabName, prefabName);
        instance = await UIUtility.CreateWidget(prefabName, prefabName);
        if (this == null || instance == null)
        {
            if (null != instance)
            {
                DestroyImmediate(instance);
            }
            return;
        }
        instance.transform.SetParentEx(this.transform, Vector3.zero, Quaternion.identity, Vector3.one);
    }