Search Unity

Question TileMap Collider Lagging

Discussion in 'Physics' started by theInsomniacGameMaker, Mar 30, 2023.

  1. theInsomniacGameMaker

    theInsomniacGameMaker

    Joined:
    Aug 6, 2018
    Posts:
    3
    I'm working on a 2D system where you can add tiles and create shapes. If the tiles are connected, they act as one shape. You can delete and add tiles anytime. You can load premade shapes too. (You can find the image attached)

    When this shape is Kinematic and is not moving, I have decent FPS. When switching the
    rigidbody
    to
    kinematic
    , it drops the FPS to 1-3. Profiling this, I found the issue. It is a function called
    Physics2D.FindNewContacts


    Is there any way to optimize this? Or something I can do to make sure the game doesn't lag?

    I have also attached the image of the profiler. If you need more information, please let me know! I really appreciate any help you can provide.
     

    Attached Files: