Example #1
0
        private static void LoadAssetAsyncWithType <T> (string path, string groupName) where T : UnityEngine.Object
        {
            if (groupName == null)
            {
                groupName = Stage.currentSceneName;
            }

                        #if UNITY_EDITOR
            if (Common.IsDebug)
            {
                if (!File.Exists(Constants.ResDirPath + path))
                {
                    throw new LuaException(string.Format(Constants.E5001, path));
                }

                DispatchLuaEvent(EVENT_START, path);
                Common.looper.StartCoroutine(DispatchCompleteEvent(path,
                                                                   UnityEditor.AssetDatabase.LoadAssetAtPath <T> (Constants.ResDirPath + path)
                                                                   ));
                return;
            }

            string pathMD5 = GetPathMD5(path);
            if (!s_resDic.ContainsKey(pathMD5))
            {
                throw new LuaException(string.Format(Constants.E5001, path));
            }
                        #endif

            s_delayedUnloadList.Remove(groupName);

            ABI abi = GetAbiWithAssetPath(path);
            abi.AddAssetAsync(path, typeof(T));
            ABLoader.LoadAsync(abi, groupName);
        }