Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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
0
Question by btb200 · Oct 04, 2013 at 01:14 PM · assetsloadingmemoryresourcesprevent

Prevent Resources class from loading assets when application starts

Hi! My application has a lot assets in Resources folder, but I use only some part of them at one time. Before first scene is loaded, my app takes over 700MB of memory... In Start method in my MonoBehaviour class I use Resources.UnloadUnusedAssets() and it frees over 600MB :) After that everything works just fine.

Is there any way to prevent UnityPlayer from loading all assets into memory when application starts?

Comment
Add comment
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

1 Reply

· Add your reply
  • Sort: 
avatar image
1

Answer by Lovrenc · Oct 04, 2013 at 01:15 PM

Resources is special folder in unity (List of special folders). Unity always loads all assets from resources folder. You can move assets to different folder. Then unity will determine what he needs and will only load those assets.

Use Resources folder for assets that are not by default in your scene, but there might be a case in which you want to put it in the scene. Unity will load them and you can access them via Resources.Load.

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 btb200 · Oct 04, 2013 at 01:48 PM 0
Share

Thanks for answer! The problem is that my app has to work on Windows PC, Android and iOS... There is only one scene and it loads and unloads assets dynamically based on xml files... Resources class is the only way to manage all assets on many platforms... I don't understand why by default every asset from Resources folder has to be loaded into memory when app starts... especially when everything works when I use Resources.UnloadUnusedAssets()

avatar image btb200 · Oct 28, 2013 at 01:45 PM 0
Share

O$$anonymous$$, have some new informations... Before, I used Resources.LoadAll("Path/", typeof(TextAsset)); to load my xml files containing informations about my scenes... After calling this function usage of memory grown to almost 1GB :/ Now I load each xml file separately using Resources.Load("Path/", typeof(TextAsset)); and problem is solved... but only on Windows... Under Android it still loads whole resources into memory when application starts :/ Please, help me... (going insane)

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

16 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 avatar image

Related Questions

Are the assets of referenced assets loaded into memory? 1 Answer

How can I dynamically load assets when they're needed? 1 Answer

Long load time for scene... Some optimization questions. 1 Answer

Memory overhead associated with assets in Resources 0 Answers

Resources.load 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