Пример #1
0
		public static bool LoadAssetAsyncCallback<T>(string assetBundleName, string assetName, Func<T, bool> onAssetLoaded) where T : UnityEngine.Object
		{
			AssetBundleManager.Initialize();
			if (AssetBundleManager.m_Instance)
			{
				if (string.IsNullOrEmpty(assetBundleName) || string.IsNullOrEmpty(assetName))
				{
					Debug.LogError("## Empty bundle or asset name: assetBundleName=" + assetBundleName + ", assetName=" + assetName);
					return false;
				}
				AssetBundleLoadAssetOperation assetBundleLoadAssetOperation = AssetBundleManager.LoadAssetAsync(assetBundleName, assetName, typeof(T));
				if (assetBundleLoadAssetOperation != null)
				{
					if (!AssetBundleManager.m_PendingRoutines.ContainsKey(onAssetLoaded))
					{
						Coroutine value = AssetBundleManager.m_Instance.StartCoroutine(AssetBundleManager.LoadAssetAsyncCallbackRoutine<T>(assetBundleName, assetBundleLoadAssetOperation, onAssetLoaded));
						AssetBundleManager.m_PendingRoutines.Add(onAssetLoaded, value);
					}
					return true;
				}
			}
			return false;
		}