Example #1
0
        /// <summary>
        /// Loads the asset bundle with all its dependencies.
        /// </summary>
        /// <returns>The with dependencies.</returns>
        /// <param name="uri">URI.</param>
        public static AssetBundleRef LoadWithDependencies(string uri, int ttl)
        {
#if PROFILE_FILE
            Profiler.BeginSample("BundleHelper.LoadWithDependencies");
#endif
            uri = fixBundleUri(uri);
            AssetBundleRef bundle = BundleManager.LoadWithDependencies(uri, ttl);
#if PROFILE_FILE
            Profiler.EndSample();
#endif
            return(bundle);
        }
Example #2
0
        public static GameObject LoadAndCreate(string name, int ttl)
        {
#if UNITY_EDITOR && LOAD_FROM_EDITOR
            return(LoadAndCreateInEditor(name, ttl));
#else
#if PROFILE_FILE
            Profiler.BeginSample("BundleHelper.LoadAndCreate");
#endif
            var uri       = fixBundleUri(name);
            var bundle    = BundleManager.LoadWithDependencies(uri, ttl);
            var assetName = getAssetName(name);
            var go        = bundle.LoadAsset(assetName) as GameObject;
            var result    = GameObject.Instantiate(go);

#if PROFILE_FILE
            Profiler.EndSample();
#endif
            return(result);
#endif
        }