예제 #1
0
        //--------------------------------------------------------------------------
        // Load asset from the given assetBundle.
        static public AssetBundleLoadBundleOperation LoadAssetBundleAsync(string assetBundleName)
        {
            Log(LogType.Info, "Loading " + assetBundleName + " bundle");

            AssetBundleLoadBundleOperation operation = null;

#if UNITY_EDITOR
            if (SimulateAssetBundleInEditor)
            {
                string[] assetPaths = AssetDatabase.GetAssetPathsFromAssetBundle(assetBundleName);
                if (assetPaths.Length == 0)
                {
                    Debug.LogError("There is no assetbundle with " + assetBundleName);
                    return(null);
                }

                // @TODO: Now we only get the main object from the first asset. Should consider type also.
                Object target = AssetDatabase.LoadMainAssetAtPath(assetPaths[0]);
                operation = new AssetBundleLoadOperationSimulation(target);
            }
            else
#endif
            {
                assetBundleName = RemapVariantName(assetBundleName);
                LoadAssetBundle(assetBundleName);
                operation = new AssetBundleLoadOperationFull(assetBundleName);
                m_InProgressOperations.Add(operation);
            }
            return(operation);
        }
예제 #2
0
        static public AssetBundleLoadBundleOperation LoadBundleAsync(string assetBundleName)
        {
            Log(LogType.Info, "Loading " + assetBundleName + " bundle");

            AssetBundleLoadBundleOperation operation = null;

            assetBundleName = RemapVariantName(assetBundleName);
            LoadAssetBundle(assetBundleName);
            operation = new AssetBundleLoadBundleOperation(assetBundleName);

            m_InProgressOperations.Add(operation);

            return(operation);
        }