• 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 rooted · Feb 25, 2014 at 02:23 AM · optimizationprofilerframerate

Locate cause of massive frame rate drop

I'm fairly new to Unity and the profiler. I have a level that runs smooth 60+ FPS throughout the level until I point the player towards a specific location from two opposing angles. I need help pin pointing the cause of the frame rate drop. When I look at the profiler, whenever I point towards this direction the CPU and "Other" spike up. I have tried clicking off most everything but I can't find the root of the problem. Any tips on finding what is causing the drop in FPS?

I know, I know, ..."don't point in that direction," right? :-D

alt text

Comment
Add comment · Show 20
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 Nanobrain · Feb 25, 2014 at 02:35 AM 0
Share

Show code please

avatar image DiligentGear · Feb 25, 2014 at 02:41 AM 1
Share

Can you show us the whole deep profiling screenshot?

EDIT: screenshot is broken.

avatar image Invertex · Feb 25, 2014 at 03:00 AM 1
Share

Perhaps a loop is happening with however you're rotating your character, we'll likely need to see the code on your player movement.

avatar image rooted · Feb 25, 2014 at 03:33 AM 0
Share

Sorry, screen shot of profiler fixed.

avatar image whydoidoit · Feb 25, 2014 at 03:35 AM 0
Share

We need you to have put the profiler's cursor on the area of issue - the screenshot appears to be on the first frame and nothing is taking any time.

avatar image rooted · Feb 25, 2014 at 03:50 AM 0
Share

Updated the screen shot. At the middle is when it jumps.

avatar image whydoidoit · Feb 25, 2014 at 03:52 AM 0
Share

Ok so that picture is too small to see :S and You need to click in the profiler graph where that slow down happens so the bottom part shows the performance in that frame. Click on the CPU chart in that area and post it. Then click on the GPU part and post it.

I'm guessing from the shape of the chart that something is doing a lot more GPU work than expected.

avatar image getyour411 · Feb 25, 2014 at 04:19 AM 0
Share

While it is a small pic, doing CTRL+ to zoom-in (FFX anyway) gets close enough see that Texture $$anonymous$$emory takes a dramatic upturn at the trouble spot.

avatar image rooted · Feb 25, 2014 at 04:26 AM 0
Share

new images

avatar image Invertex · Feb 25, 2014 at 04:29 AM 0
Share

Look under $$anonymous$$emory where it says "Texture $$anonymous$$emory", and click that, so you can see on the bottom right what is being allocated there that's causing the spike. It appears that something is causing your texture memory to fill up completely, which will create a massive frame-rate drop.

avatar image Invertex · Feb 25, 2014 at 04:43 AM 0
Share

Expand the Camera.Render in your operations list...

avatar image rooted · Feb 25, 2014 at 05:11 AM 0
Share

new expanded pic. Still not sure what I'm looking for, nonetheless how to fix it. $$anonymous$$ight be a texture setting that needs adjusting?

avatar image Invertex · Feb 25, 2014 at 05:19 AM 0
Share

$$anonymous$$ove to a position in the profiler timeline before the spike happened, and look at the difference on the list on the right. Right now, you've got what looks like thousands of textures being drawn....

Show more comments
avatar image nesis · Feb 26, 2014 at 05:02 AM 0
Share

Yep that's how occlusion culling works, disabling / enabling mesh renderers. If you don't need GameObjects or scripts to be updating when you're not looking at them (or aren't near them, or whatever), then you can turn those off as well. If your scripts do something that runs over consecutive frames and might suffer from being enabled / disabled, you can use methods called OnEnable() and OnDisable() to help handle that.

$$anonymous$$ass disables are ok, as far as I understand. It's much more efficient than just leaving scripts / components enabled, at least.

I feel like I'm saying this a lot today, but you might want to look into Unity's built in occlusion culling if you have Unity Pro. With it you mark objects as static (ie, will never move) and they get hidden / unhidden as the camera moves around the level.

Alternatively, you can do your own simple occlusion culling on both static and dynamic objects by for example placing triggers between areas fully occluded from one another, and enabling / disabling GameObjects that way.

Changing the far clip plane will work for large areas, but the best method is really just controlling what components / GameObjects are enabled.

avatar image rooted · Feb 26, 2014 at 05:23 AM 0
Share

Thanks nesis, I'm working on the mass enable/disable GameObjects plan. I tried marking all relevant objects as "static" but whenever the camera pointed in their direction they still show up in the profiler as being rendered and caused FPS to suffer. Is there more to it than just marking them "static" in the inspector?

avatar image flamy · Feb 26, 2014 at 05:29 AM 0
Share

u got 3300+ drawcalls, does it need a reason y it shouldnt lag??

avatar image nesis · Feb 26, 2014 at 05:38 AM 0
Share

Yep, if you've got Unity Pro you should be able to click Window -> Occlusion Culling and have a small window pop up to let you start a (sometimes lengthy!) process that'll set Unity up with what it needs to know when to enable / disbale rendering what GameObjects you've marked as static.

The general process is to define rectangular volume(s) outside of which your camera will never travel, and to mark any and all never-going-to-move GameObjects as static. Then you start the occlusion culling process and wait some time dependent on the complexity and amount of your mesh geometry, and size of the rectangular volumes for your camera.

$$anonymous$$ore info on the process can be found here.

If you don't have Unity Pro, you'll need to implement occlusion culling yourself, or perhaps get a package for it from the asset store. I've got a feeling you'd prefer doing it yourself, so the general solution you want is area portals. Enter a trigger, it disables a list of $$anonymous$$eshRenderers and/or GameObjects, and enables another list of $$anonymous$$eshRenderers and/or GameObjects. I tend to do this with room-based level design, so I keep a room active either side of the one I'm currently in, and disable others as necessary. For simplicity's sake, I also try to parent all GameObjects in one room to a GameObject named after the room, so all I need to enable / disable is that room without caring what's inside it as I change the level around.

avatar image nesis · Feb 26, 2014 at 05:55 AM 0
Share

You'll also want to look into the number of GameObjects you have at once. Drop that number down (eg via the Combine $$anonymous$$esh utility script you can import via Assets -> Import Package) and you might get better performance without occlusion culling.

How many GameObjects are in your scene, anyway? Are they high poly? Do they have many different materials? If you go to your Scene tab, there's a dropdown at the top that should say RGB at the moment. Click it and change to Overdraw. This will show you how many objects are drawing over each other, so move your camera to where framerate drops and see what it looks like. The brighter the orange, the more overdraw, and the slower framerate you'll get from that particular view.

avatar image rooted · Mar 01, 2014 at 01:33 AM 0
Share

Thank you so much nesis! I am trying out some of those options with vary degrees of success. There is definitely a lot of overdraw and I am trying to reduce it by creating enable/disable GameObject trigger zones through animation and occlusion culling. I am having difficulty getting occlusion culling to work smoothly without seeing things flicker or just pop on/off. The room /GameObject trigger zones work very effectively but gets tricky with areas that are just corridors.

Lighting is another area that I am trying to optimize. I like the behavior of the lights only when they are set to "Important + Real-Time." When I bake anything into textures it doesn't work well with any other moving real-time lights in the vicinity. Whole blocks of texture get lit up and flicker. I'd appreciate any tips on this matter as well.

0 Replies

· Add your reply
  • Sort: 

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.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

27 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

Related Questions

Andriod (Oculus Quest 2 app) locked at 30 fps 1 Answer

low FPS when battery is low ( unity android ) 0 Answers

Very Bad Performance on Android 3 Answers

Framerate drops from 60 to 20 because of meshrenderer? 0 Answers

Low FPS when against a wall? 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