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
4
Question by AntiLunchBox · Apr 13, 2016 at 09:35 PM · loadingreferenceperformance optimizationresources.load

Performance of Resources.Load vs Direct Reference vs Resources.LoadAsync for large level assets

Hi,

I was wondering if I could get a straight answer from someone on this question. The forums all say different things. What is the best way to load large assets at runtime? Direct reference in a script or Resources.Load? I know technically Unity supports direct reference so that the build will know what assets to not include. I use direct reference for most assets in my game. However I have around 85 levels (represented by scriptable object files) and I don't really want to load all 85 of them at once, especially since they have large prefabs attached--but I know I definitely want to load them at some point one at a time. In this case, is it better to use Resources.Load? Or should I pile them all onto a "resources" GameObject I put in my initial scene with DontDestroyOnLoad? Seems like that method would eat up a bunch of memory, unless Unity will automatically handle what's not being used?

I have currently tried a few options with Resources.load, which all ended horribly since Unity5. Especially on Android. Even in my smallest level, with really nothing in it--Resources.Load will take around 12 seconds. I used to use Resources.LoadAll in a certain folder at app start, and that made my app launch last around 20-30secs. The thing is, after the first use of Resources.Load, any subsequent use is pretty fast--it turns into what I'd consider to be normal load times.

I'd really like to launch my game, but this is becoming a nasty issue. With Resources.Load, it's looking like I inevitably have to suffer a long load time somewhere in my user's first 2 minutes--which is the most important window for capturing users. It'd be great to get some guidance here. Some forums say it's better to use direct reference regardless of asset size..but this is a lot of large assets.

What about Resources.loadasync?

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 CunningGrayFox · Sep 05, 2016 at 08:10 PM 0
Share

I'm experiencing a similar issue with Resources.LoadAll on Android devices. Depending on the device it can take 12+ seconds to complete. I'm currently looking at alternatives but i can't find much about it's poor performance. I'll try Resources.LoadAsync to see if that helps any. I've also been looking at loading my resources using the AssetDatabase methods but I'm not sure if it'll work correctly.

1 Reply

· Add your reply
  • Sort: 
avatar image
2

Answer by Xarbrough · Sep 05, 2016 at 09:18 PM

Reference is faster than Resources.Load. The Async variant can help if you want to load something in the background. However, it sounds unlikely that the load time alone takes 12 seconds. How big exactly is it? You can load quite a few megabytes in 12 seconds, so it's much more likely that some instantiation code or anything running in Awake or Start slows things down. Have you profiled your game in the editor and on device? You will need to start the Profiler in a different scene before you can record any calls made in Awake, since this is when the Profiler is created. What's the target hardware?

Maybe there is some issue with how you are loading or creating things, if not, then you probably are looking for multiple optimizations: smaller textures, fewer geometry, smaller hierarchy, etc.

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

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

45 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 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 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

Help performance issues 0 Answers

Asset bundles and scene references 1 Answer

Assetbundle loading time 0 Answers

Scriptable Object references if not saved in AssetDatabase? 1 Answer

How do I load music optimally? 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