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 yoyo · Apr 26, 2010 at 04:40 AM · assetfileresources

How can I unload a single resource?

I can use Resources.Load(path) to load a single resource file. How can I unload it?

  • Object.Destroy says I can't destroy an asset

  • Object.DestroyImmediate destroys the resource, and the underlying asset, and requires me to re-import in the editor (surprise!)

  • Resources.UnloadUnusedAssets doesn't let me pick which resource to unload

Should I just use UnloadUnusedAssets anyway?

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 yoyo · Apr 26, 2010 at 05:01 AM 0
Share

Resources.UnloadUnusedAssets seems to be a frame rate killer, so I'd like to avoid if I can.

avatar image yoyo · Apr 26, 2010 at 05:02 AM 0
Share

And yes, I believe AssetBundles would solve the problem, but I'm using the free edition of Unity, so AssetBundles are not available to me.

2 Replies

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

Answer by Datael · May 16, 2012 at 06:43 AM

A new method has been added in Unity 3.5.2 that should do what you are after:

 Resources.UnloadAsset(Object asset);

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 Demigiant · Jul 17, 2012 at 01:25 PM 0
Share

Great! Didn't know that, thanks

avatar image yoyo · Oct 26, 2012 at 04:34 AM 0
Share

Except it complains that it can't be used on a GameObject :(

avatar image
0

Answer by StephanK · Apr 26, 2010 at 09:57 AM

http://forum.unity3d.com/viewtopic.php?p=226347

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 yoyo · Apr 27, 2010 at 02:06 AM 0
Share

Thanks for the link. The thread suggests using Destroy to unload assets ("You need to Destroy() assets and remove all references to them in order to clean the memory after loading them."), but as I mentioned above this technique doesn't work. I suspect it would be the right approach if I was procedurally generating the assets, but for my use case it doesn't work.

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

3 People are following this question.

avatar image avatar image avatar image

Related Questions

Access path of stored asset 0 Answers

Create JPG to HDD from Image In Assets-Folder 0 Answers

What are the minimum file types I'll need to import for using 3d assets? 1 Answer

Resources.FindObjectsOfTypeAll() doesn't return all Textures 2 Answers

GameObject permanent destruction from "Resources" in EditorWindow 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