- Home /
PolygonCollider2D & framerate performance
Hello everyone,
I am running into a framerate performance issue when moving a ship gameobject with multiple PolygonCollider2Ds attached to it. I currently have a game object with 22 separate PolygonCollider2Ds attached to it, corresponding to different aspects of the gameobject e.g. firing arcs, areas corresponding to various ranges from the ship's hull zones, & shields. Each PolygonCollider's bounding points are calculated programmatically. When in a scene with more than one ship, the framerate drops into the single digits according to the profiler. From my (albeit limited) understanding & research, this likely has to do with the fact that PolygonColliders are more intensive to use due to their complexity. The problem is is that I need these colliders to be defined as polygons as opposed to simple circle/box colliders in order to utilize their unique shapes (see attached image).
I initially tried setting the corresponding Rigidbody2Ds for each collider to simulate=false when the ship starts moving and then reactivating when the ship's movement has finished and this definitely caused the performance in improve greatly, however this caused issues in my code that is run after a ship has finished moving. The collisions I really only need to check once a ship has performed it's move (this is a turn-based game). Would setting the various colliders as triggers here be better? Should I remove all of the rigidbody2d objects from the various colliders except for the ship's body itself?
Is there a better approach out there to moving a bunch of PolygonCollider2Ds without causing a framerate choke?
Your answer
![](https://koobas.hobune.stream/wayback/20220613041506im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Performance issues when moving 2D colliders by code. 1 Answer
Performance of player detection: Colliders/Triggers vs OverlapCircle 2 Answers
Mouse click on line - performance question 1 Answer
EdgeCollider2D or BoxCollider2D? 1 Answer
How to improve the Performance of Removing Trees during runtime? 1 Answer