Example #1
0
        private static T LoadAssetWithType <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));
                }
                return(UnityEditor.AssetDatabase.LoadAssetAtPath <T> (Constants.ResDirPath + path));
            }

            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);
            ABLoader.Load(abi, groupName);
            return(abi.ab.LoadAsset <T> (Constants.ResDirPath + path));
        }