Hi everyone, I'm not a expert in Unity, and I currently I'm having some trouble with performance issues.
So basically I'm doing a geographical app with Unity, and I's working ok but with performance issues. My problem is that I have to much buildings, with meshes being created in runtime ( several thousands :-) ).
So I decided to try another approach. Instead of creating a game object for each building, I'm creating a game object for each Material. And after calculating the vertices for each building i'm adding it to the corresponding mesh (by material).
And with that, I can see a great improve in performance... Nice right.. But now I have a problem of updating those meshes... Suppose we are navigating in the map and I need to remove and add buildings.... Adding new buildings is no problem and it's working properly, but removing is the problem...
So taking in account the performance, I thought it would be fine... Just remove the triangles from those buildings ( Also tried to remove vertices, Uvs, colors,--- from the mesh , but it's not so performance ... ). I still have the "building" object (not a game object of course...) with the "StartIndex" in the triangles array of the Mesh the buildings belongs... But after I remove the triangles from one building, all the others buildings "StartIndex" are invalid....
So I'm thinking... For every building I remove from the mesh I have to update all the "StartIndex" from the others buildings... ( Good bye performance :-) , or not I didn't test yet... ) , and not all buildings have to update the index in the triangles array, only those that have a higher index right ???
So my real question to anyone that can and want to help is this:
I'm missing something here ? How you experts would approach this issue?
Using submeshes even sharing the same material will have impact in performance? I will end with a lot of submeshes at the end....
And after I get this issue, I still have the issues of the colliders right ? Removing the triangles from a mesh, the MeshCollider swill not ajust to visible triangles....
Any help or ideia will be very appreciated.
Thanks a lot. Cheers.
Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.
The best place to ask and answer questions about development with Unity.
To help users navigate the site we have posted a site navigation guide.
If you are a new user to Unity Answers, check out our FAQ for more information.
Make sure to check out our Knowledge Base for commonly asked Unity questions.
If you are a moderator, see our Moderator Guidelines page.
We are making improvements to UA, see the list of changes.
Answers and Comments
4 People are following this question.
Can an empty state in Animator cause performance issues?
Are the prefabs stored in RAM or in the Hard disk?
Can i link an object to a moving object to save performance ?
Bad iOS Performance after good android build.
Tiled GPU Perf. warning because of a camerascript