//异步加载 public static void LoadAsync(string path, Type type, Action <Object> onLoadComplete) { if (type == null) { type = typeof(GameObject); } Action <AsyncOperation> onComplete = null; Object prefab; if (!Instance.prefabMap.TryGetValue(path, out prefab)) { Debug.Log("<color=red>find not prefabTemp</color>"); if (onLoadComplete != null) { onComplete = delegate(AsyncOperation req) { AssetBundleRequest request = (req as AssetBundleRequest); if (request.asset == null) { Debug.LogError("failure to load asset"); } else { Object obj = request.asset; Instance.prefabMap[path] = obj; onLoadComplete.Invoke(obj); } }; } BundleManager.GetAssetAsync(path, type, onComplete); return; } Debug.Log("<color=yellow>find prefabTemp</color>"); onLoadComplete.Invoke(prefab); }