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
1
Question by alexandre-fiset · Jun 25, 2015 at 10:12 PM · c#instantiateperformance

Is there a way to optimize Loading.PersistentManager?

My team is hard at work creating an adventure game set in a large, 3 square-mile open environment.

Using Unity 5, we split around 40 big terrains into 10K smaller, more "streamable" chunks.

It works quite well, with terrain instatiation not taking too long, around 1 ms to be precise. The problem is that one Unity function is taking A LOT of CPU time, around 50 ms on my Intel i5. The function is called Loading.PersistentManager and I really don't know what it does.

I have read two threads on the matter, but no one seems to know anything about it and how to reduce its impact on the machine.

Any loading/streaming guru out there who could help?

alt text

persistentmanager.png (226.9 kB)
Comment
Add comment · Show 4
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 alexeyzakharov · Jul 07, 2015 at 12:10 PM 1
Share

Persistent$$anonymous$$anager is an internal class that manages loaded objects. Loading.LockPersistent$$anonymous$$anager time corresponds to the read object's data event. How do you load the terrain chunks - are you using LoadLevelAdditiveAsync/LoadAssetAsync? And what are the chunks - scenes/prefabs?

avatar image alexandre-fiset · Jul 07, 2015 at 01:12 PM 0
Share

We use Resources.LoadAsync to load prefabs that contain several GameObjects (branches, decals, trees) and one terrain for each call. It is weird as this overhead only appears in a build, not in the editor.

avatar image alexeyzakharov · Jul 08, 2015 at 01:33 PM 1
Share

$$anonymous$$ore likely it is waiting for completion of some other load operation. $$anonymous$$ight also happen if you access ResourceRequest.asset before loading is done (http://docs.unity3d.com/ScriptReference/ResourceRequest-asset.html).

avatar image alexandre-fiset · Jul 08, 2015 at 02:33 PM 0
Share

To quote my colleague post on the forums: "...it seems to be only in a built player. We load small terrain chunks asynchronously and it works quite well, but every now and then Loading.LockPersistent$$anonymous$$anager shows up and takes a lot of time. It happens when we access the ResourceRequest.asset value. When I decompile UnityEngine.dll, it shows that ResourceRequest.asset calls Resources.Load(string path, Type systemTypeInstance);

I guess it has to do with some kind of multithreaded lock. Resource.Load must try to access some locked value while another background loading is taking place in another thread, making the main thread wait for this loading to end. It seems to happen less frequently in FixedUpdate(), but it may be an illusion.

No matter where I put the ResourceRequest.asset call, it still happens. It would be pretty nice if Unity would fix this. I might try to make a small project to submit a bug, but it's a bit tricky."

2 Replies

· Add your reply
  • Sort: 
avatar image
1

Answer by jhughes.artcraft · May 20, 2016 at 02:24 PM

For what it's worth, LoadAsync("") tells Unity to load EVERYTHING in the Resources folder. That is a pretty expensive operation.

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 jeromeWork · Dec 19, 2018 at 01:29 AM 0
Share

Thank you... that one nugget of information is priceless!

avatar image
0

Answer by tayl0r · Apr 08, 2016 at 08:50 PM

I just had this problem too, and it was because we were doing Resources.LoadAsync() on an empty or null string (it might also happen if the resource doesn't exist). I was seeing the same thing with Loading.LockPersistentManager, but in my case it was taking 3000+ ms!

I fixed the bad Resources.LoadAsync() call and now it's working normally again.

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

25 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

Related Questions

Distribute terrain in zones 3 Answers

Multiple Cars not working 1 Answer

Activating GameObject(s) is slow 2 Answers

Performance issues when creating many tiny objects 1 Answer

IL2CPP Unused local just for stack balance error 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