Quantcast
Channel: Questions in topic: "webgl"
Viewing all articles
Browse latest Browse all 2390

Load Scene from assetbundle WebGL (lightmapped)

$
0
0
Hi guys, what is the best way to load scenes in WebGL ? I have one main scene and 10 others. I dont want to load all scenes at the initial downloading. I had tried to build assetbundle from one testing scene with the script from docs. [MenuItem("Assets/Build AssetBundles")] static void BuildAllAssetBundles() { BuildPipeline.BuildAssetBundles("AssetBundles",BuildAssetBundleOptions.None,BuildTarget.WebGL); } and then load it with this one from public IEnumerator loadScene() { Debug.Log("started"); using (www = WWW.LoadFromCacheOrDownload(url, 1)) { yield return www; if (string.IsNullOrEmpty(www.error)) { AssetBundle assetBundle = www.assetBundle; if (assetBundle != null) { string[] scenePath = assetBundle.GetAllScenePaths(); string mySceneName = scenePath[0]; mySceneName = mySceneName.Substring(0, mySceneName.Length - 6); mySceneName = mySceneName.Substring(mySceneName.LastIndexOf("/") + 1); UnityEngine.SceneManagement.SceneManager.LoadScene(mySceneName); } else Debug.Log("assetBundle is null"); assetBundle.Unload(false); www.Dispose(); } else Debug.Log(www.error); } The problem is that after i run the script .. after download i have a black screen ..... Can anybody solve my problem ? Or is there a better way to reduce the waiting time and ram consumption ? I tried to bundle just the objects from the scenes but they are lightmapped ...

Viewing all articles
Browse latest Browse all 2390

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>