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 /
  • Help Room /
This question was closed Feb 02, 2020 at 05:09 PM by Gloubi for the following reason:

The question is answered, right answer was accepted

avatar image
0
Question by Gloubi · Feb 02, 2020 at 11:02 AM · performanceprofilerperformance optimizationprofiling

Performance issues with many objects/lights

Hello!

I'm currently struggling a bit with performance. I do not really understand how to use the profiler properly to see what's going on.


My game consists mainly of:

  • a tunnel, that I generate randomly at runtime around a Bezier curve (I compute all the vertices, triangles, and uvs and create the mesh from that)

  • cubes, with a light component and an emission texture, "spawned" from a pool of 300 objects

  • a few other but rare objects, so probably quite insignificant


Here you can see the profiler with the cursor placed on a "normal" time, when FPS is quite high

alt text


And here you can see the profiler with the cursor placed on a "performance spike" time, when FPS gets lower.

alt text


In general, on my computer, both normal and spike time are very playable as you can see (around 100 FPS at worst), but on my Android phone, this gets terribly laggy and barely playable (even a very recent phone like the OnePlus 7T is still much less powerful than a desktop computer!)


What I have tried so far to improve performance:

  • disabling the lights on the cubes

  • disabling the emission texture of the cubes

  • marking my custom tunnel mesh as static (but I believe this has no effect on an object created at runtime?)

No significant improvement observed.


My questions are:

  • how to determine what slows the game down?

  • how to determine what causes those spikes?

  • how can I improve the performance overall?


Thank you!


profiler-normal.png (414.8 kB)
profiler-spike.png (396.0 kB)
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

  • Sort: 
avatar image
1
Best Answer

Answer by Gloubi · Feb 02, 2020 at 05:09 PM

Found the answer to my questions: what was slowing down the whole thing was that, since I had a lot of cubes as single meshes, Unity had to draw each of them individually, which is very costly. The solution is then to combine the meshes together. I copied and modified this script https://github.com/mirrorfishmedia/ProceduralContentGenerationBasics/blob/master/Assets/Scripts/ProceduralBasics/MeshCombiningAreaSpawner.cs

Now everything runs smoothly :) I hope this can help someone else in the future ;)

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

Follow this Question

Answers Answers and Comments

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

How to Limit FPS? vSync problem (WaitForTargetFPS),How to Limit FPS but without VSYNC? 0 Answers

Mobile Performance Issues 0 Answers

Horrible Lag spike when Looking at an object that's showing GUI 1 Answer

GameView.GetMainGameViewTargetSize() problem 0 Answers

Massive Rendering spike in profiler when unloading the scene 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