Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
1
Question by NavilSidd · Oct 19, 2015 at 11:35 PM · sceneassetbundlescenesapplication.loadlevelassetbundle.loadasync

Changing Scenes using Unity5 AssetBundle

Hiya, I'm new here and I'm using Unity version 5.2.03f and I'm new to asset bundle. I'm using AssetBundleManager to build my AssetBundles.

Ok, heres what i'm trying to achieve:

  1. Game starts at Scene1.

  2. Load Scene2 from asset bundle and change scene to Scene2.

  3. Load Scene3 from asset bundle and change scene to Scene3.

This code is included in a GameObject at the start to initialise the AssetBundleManager:

 protected IEnumerator Initialize()
     {
         DontDestroyOnLoad(gameObject);
 
         #if DEVELOPMENT_BUILD || UNITY_EDITOR
         AssetBundleManager.SetDevelopmentAssetBundleServer ();
         #else
         AssetBundleManager.SetSourceAssetBundleURL(Application.dataPath + "/");
         #endif
         
         var request = AssetBundleManager.Initialize();
         
         if (request != null)
             yield return StartCoroutine(request);
     }

And this script is in a Loading game object that won't be destroyed and stayed throughout the game, Loading.cs:

 using UnityEngine;
 using System.Collections;
 using UnityEngine.UI;
 using AssetBundles;
 
 public class Loading : MonoBehaviour {
 
     public string sceneAssetBundle;
     AssetBundleLoadOperation request;
 
     public void LoadScene(string level){
         StartCoroutine (LoadingScreen(level));
     }
 
     IEnumerator LoadingScreen(string level){
         request = AssetBundleManager.LoadLevelAsync (sceneAssetBundle, level, true);
         if (request == null)
             yield break;
     }
 }

By using the function LoadScene from Loading.cs, I can load the scenes with no error. But the scenes keep overlapping one after another. and Application.loadedLevelName is always Scene1.

My Question is, how do i delete the previous scene when i opened a new scene OR how do i use Application.LoadLevel() with the new AssetBundle. Thanks!

Comment
Add comment · Show 1
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image amin-ad · Jan 31, 2017 at 10:07 AM 0
Share

i am trying to do something like that but i think it is impossible, i tried to save scenes from WWW to local storage and replace them with main scenes but i couldn't do that. may be we should let the user choice between current scene and the DLC ...

0 Replies

· Add your reply
  • Sort: 

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

How to load Level using scene object?? 2 Answers

How do i create a level lock system? 1 Answer

pre-load multiple scenes but only activate one 0 Answers

Assetbundle LoadAsyc speed is much slower than Load 1 Answer

What things cause this message?The content was stopped because a... 3 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges