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 ICEYHOTSTUNTA · Oct 09, 2014 at 08:28 PM · renderingperformanceoptimizationlevelrender

Rendering Spike When Switching Levels

So I have two levels divided by a door. I'm keeping the second level hidden while the player plays through the first area, then as the door opens I'm turning on the second level just before the player enters it.

As soon as I switch the second level on, I get a huge spike in rendering time for one frame, and then it calms down and runs normally. I'm trying to find a way to get rid of this big hitch.

I've tried a number of ways of hiding the levels:

  • Deactivating game objects causes an even worse spike as calling OnEnable on numerous objects tends to be costly

  • Turning off all of the renderers in the scene actually works better than deactivating the root object, I still have this spike in render time though

  • Set each level to have a unique layer, then adjust the culling mask of my main camera. I thought this might help because I'm not activating/deactivating any components, but nope.

  • Unfortunately using "portals" and occlusion culling won't work for me since I'm building these levels proceduraly.

Any ideas what is causing this super long frame and how to fix it? The bigger the scene I am transitioning to the worse the spike. Even on PC for a large scene I'll have one frame that takes 600 ms to render the scene, then it drops down to ~5 ms next frame.

Thanks for your help!

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
0
Best Answer

Answer by ICEYHOTSTUNTA · Oct 10, 2014 at 06:40 PM

I seem to always end up answering my own questions...

Anyway maybe this will help someone else. I guess the first time Unity renders something it has to load some infomation (textures, etc...) onto the GPU, so the first time you reveal something huge like a big level to the camera there is a big spike.

To fix the spike I load all my levels, make them all visible but put up a load screen over top. Then I fly my game camera around randomly so hopefully it sees most of the stuff it has to draw later. It's a pretty dirty solution, but it seems to work fine.

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

28 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

Related Questions

Can the Cull option in shader improve perfomances ? 2 Answers

Bad performance on Android 0 Answers

A lot of static objects affects the performance 0 Answers

What's killing my rendering performance? (pic included) 1 Answer

Is there any way I can statically batch procedurally generated objects? 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