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
2
Question by Bill · Apr 20, 2010 at 09:40 PM · sceneassetbundlewww

AssetBundle.Unload(false)

I had a previous discussion in regards to Unloading asset bundles after downloading them. In the reply Lucas had mentioned that it is always a good idea to unload the bundles to free up memory. However, I am a bit confused when it comes to scenes that reside in asset bundles. For instance, see the below code snippet. If I unload the asset bundle after loading the scene, I assume that the asset bundle will be removed from memory and the scene is still in memory. However, this is not the cause. Unloading the asset bundle seems to be unloading the entire scenes contents. Based on the documentation for Unload, passing a value of false to it indicates that this behavior should not be occuring??? Am I missing something here?

public IEnumerator LoadScene() { WWW stream = new WWW("assetBundles/dynamicScene.unity3d");

 yield return stream;


 AssetBundle bundle = stream.assetBundle; 

 // Load a scene that was stored in the asset bundle.
 Application.LoadLevelAdditive("dynamicScene");

 // This will cause everything in the scene to be unloaded.
 bundle.Unload(false);

}

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 vargonian · May 27, 2015 at 06:42 PM 0
Share

We're on Unity 5 now and it's still a problem.

2 Replies

· Add your reply
  • Sort: 
avatar image
1
Best Answer

Answer by Joachim Ante · Sep 26, 2010 at 06:01 PM

The issue is that Application.LoadLevelAdditive is delayed until the next frame. Thus you are actually unloading before the level has been loaded.

You can add a yield between LoadLevelAdditive and Unload, then it should work. Better use LoadLevelAdditiveAsync and yield the result.

Comment
Add comment · Share
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
0

Answer by Dreamora · Aug 15, 2010 at 12:09 AM

Report a bug with a small sample.

While loadleveladditive does not technically load the scene as a scene but add it into the current one, instantiated stuff should be kept alive too and does so if you instantiate it directly or if you used loadlevel there

Comment
Add comment · Show 1 · Share
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 Bill · Sep 01, 2010 at 02:17 PM 0
Share

I had happen to just copy and past some code I was experimenting. But it doesn't matter if the level is loaded additively or non additively. The same behavior occurs. From my own research, scenes in asset bundles tend to work slightly differently then regular assets when loading and unloading. I'm not sure if this was by design or not. However, I had a discussion with them about this in the unity 3.0 alpha mailing list back in $$anonymous$$ay, so they are aware of the problem.

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

1 Person is following this question.

avatar image

Related Questions

how to unload asset when load new scene? 0 Answers

404 Not Found, Problem with WWW:get_assetBundle 2 Answers

asset bundles download problem 0 Answers

[AssetBundle]object is not instantiate from my server 1 Answer

Instantiate .fbx to object from MySQL Database query 1 Answer


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