/// <summary>
        /// 异步实例化资源。
        /// </summary>
        /// <param name="assetName">要实例化资源的名称。</param>
        /// <param name="instantiateAssetCallbacks">实例化资源回调函数集。</param>
        /// <param name="userData">用户自定义数据。</param>
        public void InstantiateAsset(string assetName, InstantiateAssetCallbacks instantiateAssetCallbacks, object userData)
        {
            if (instantiateAssetCallbacks == null)
            {
                throw new GameFrameworkException("Instantiate asset callbacks is invalid.");
            }

#if UNITY_EDITOR
            DateTime           startTime = DateTime.Now;
            UnityEngine.Object asset     = AssetDatabase.LoadMainAssetAtPath(assetName);
            if (asset != null)
            {
                UnityEngine.Object instance = Instantiate(asset);
                if (instance != null)
                {
                    if (instantiateAssetCallbacks.InstantiateAssetSuccessCallback != null)
                    {
                        instantiateAssetCallbacks.InstantiateAssetSuccessCallback(assetName, instance, (float)(DateTime.Now - startTime).TotalSeconds, userData);
                    }

                    return;
                }
            }

            if (instantiateAssetCallbacks.InstantiateAssetFailureCallback != null)
            {
                instantiateAssetCallbacks.InstantiateAssetFailureCallback(assetName, LoadResourceStatus.NotExist, "Can not instantiate this asset from asset database.", userData);
            }
#endif
        }
 public override void OnLoadSuccess(LoadResourceAgent agent, object asset, object instance, float duration)
 {
     base.OnLoadSuccess(agent, asset, instance, duration);
     if (m_InstantiateAssetCallbacks.InstantiateAssetSuccessCallback != null)
     {
         m_InstantiateAssetCallbacks.InstantiateAssetSuccessCallback(AssetName, instance, duration, UserData);
     }
 }