• 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 CommitteeWind · Mar 26, 2013 at 04:03 PM · editorassetbundlebuildpipelinememory-leak

How do I release editor memory?

I am building a lot of asset bundles. By themselves the asset bundles are not too big. When I start Unity3D and build the bundle, it will work flawlessly. However when I build a lot of these bundles in sequence (without restarting Unity3D) the editor runs out of memory and crashes. I have called the following code after each BuildPipeline.BuildAssetBundleExplicitAssetNames call:

 GC.Collect();
 Resources.UnloadUnusedAssets();

But this does not fix the problem...

Comment
Add comment · Show 2
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 numberkruncher · Mar 26, 2013 at 05:01 PM 0
Share

Are you making sure to destroy object instances where applicable? I would imagine that you are running out of unmanaged memory as opposed to managed memory.

avatar image CommitteeWind · Mar 26, 2013 at 06:54 PM 0
Share

@whydoidoit: your suggestions fixed the problem for me. if you make an answer of out it, i'll mark you as correct.

2 Replies

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

Answer by whydoidoit · Mar 26, 2013 at 04:13 PM

You should probably try using EditorUtility.UnloadUnusedAssets in the editor. Resources.UnloadUnusedAssets is an operation to be yielded.

Comment
Add comment · Show 2 · 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 whydoidoit · Mar 26, 2013 at 04:42 PM 0
Share

And I'd GC.Collect afterwards.

avatar image yoyo · Jan 27, 2015 at 11:56 PM 0
Share

But be careful, I've just realized that EditorUtility.UnloadUnusedAssets can destroy temporary objects created by scripts.

avatar image
0

Answer by cowlinator · Apr 29, 2013 at 07:37 PM

try AssetBundle.Unload()?

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 whydoidoit · Apr 29, 2013 at 07:58 PM 0
Share

That's a runtime call though.

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.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

15 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

How to load an AssetBundleManifest in the Editor? 0 Answers

How is asset bundle crc and hash created? 0 Answers

[iOS] AssetBundle.LoadFromMemoryAsync leak memory? 0 Answers

Can unity save Scripts In AssetBundle for Scene? 0 Answers

Loading Asset bundles and Scenes separately 0 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