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 Stonecliff · Apr 13, 2016 at 10:14 AM · timescene-loadingloadingscene loadloading during runtime

Best practices for increasing scene load times in 2d games

Title says it all, im trying to optimize my loading of scenes and i can take up to 9 seconds to load a scene sometimes and other times less than 3 seconds, im trying to pinpoint what needs to be optimized but profiling this is a lot more challenging that i thought. also noticed that once a scene has been loaded once re entering it yields a much quicker load time even if the game has been restarted which i find quite puzzling.

so where should i start?

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 Polymo · Apr 13, 2016 at 11:54 AM 0
Share

I dont think there are best practices, but you could add a loop that counts to a few millions in awake. And if you want do decrease loading times you could for example delay certain initializations until they're really needed (if you have alot of code running in awake or start). Lookup "lazy initialization" for that. Apart from that, reduce the amount of polygons/objects (lookup "Static batching"). Audio files also have an option to be preloaded or streamed.

avatar image b1gry4n · Apr 13, 2016 at 12:31 PM 0
Share

Depending on your game/scene setup, you can load assets that you will be reusing in every scene when the game initially starts and call a DontDestroyOnLoad on them. Doing that and object pooling combined will help reduce load time.

1 Reply

· Add your reply
  • Sort: 
avatar image
3

Answer by Immanuel-Scholz · Apr 13, 2016 at 12:49 PM

I am going out on a limb here and say that you have too much stuff referenced directly by your scene that gets all pulled and loaded before the game has a chance to start.

You can verify that assumption by right-clicking your scene in the editor and choose "Select Dependencies".

If that brings up like 1000 textures and 500 audio files, then you got yourself a problem. ^^.

AFAIK, Unity preloads almost everything that is directly linked in a scene file and which is not in an asset bundle. So if that is your problem, you might try one of the following:

  • Clean up all unused links. (maybe you just forgot to remove some big resources from test-objects that are deactivated anyway..?)

  • Set big audio clips like background music to streaming.

  • Pack stuff that you don't need right at the start of the game in Asset Bundles and load them asynchronously

  • Move stuff in other scenes and load them asynchronously (and additive).

  • Move stuff to Resources/ folder and load them via code once the game started

Well, of course it could be that the problem is totally somewhere else. You know.. stuff like "void Awake() { Thread.Wait(1000); }". ;)

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 Stonecliff · Apr 17, 2016 at 06:45 AM 0
Share

Hello there, thanks for the information, i did what you said and tested my scene for dependancies and what it selected were 24 small audio files used for the scene, i tried a few times but just kept finding the 24 audio files, im surprised it didnt bring up any sprite sheets but im guessing that the issue with slow loading isnt related to this then

As for awake functions i almost never call them, i think they are called about twice per scene, one in the player and one in the main manager, i mostly use start functions, and in some cases a few hindered are probably called each scene, though most of those are for a game mechanic which is used throughout the level

Do you have any other suggestions as to how to increase my load speed time? or is there any way to profile whats causing all the load time, anything at all would be greatly appreciated as im at a loss where to proceed from here

@ Immanuel Scholz

avatar image Immanuel-Scholz Stonecliff · Apr 18, 2016 at 07:56 AM 0
Share

You have really only 24 audio files selected? No prefabs? No shader? No fonts? Not even $$anonymous$$onoBehaviours?

Well.. then have you tried profiling the scene loading? (With the unity profiler). It has its hickups with long lasting frames (e.g. some times are totally off) but it could still give you valuable insight where the time might be spent.

Sprinkle some Profiler.BeginSample/EndSample all over your suspicious code to narrow it down..

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

6 People are following this question.

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

Related Questions

How to transition from Load to scene ? 1 Answer

Do the number of imported assets in your project folder impact load time? 1 Answer

SceneManager.LoadSceneAsync freeze loading scene in editor. 0 Answers

How to have the scene load after a few seconds 1 Answer

Load Scene from .unity File 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