In my game, large tilemaps are being moved via rigidbody forces. As the tilemaps got bigger, the game began to suffer from very large lag spikes. The profiler shows that 97% is being taken by Physics2D.CreateShapes > Physics2D.TilemapColliderPreparePaths. Is this a limitation of Unity, or am I doing something wrong? I have checked my code, and I don’t believe I am moving the rigidbodies via transform.position anywhere.

I was able to find a fix. For some reason, there is no way (that I found) to fix this lag, Unity’s tilemap colliders aren’t designed to move. Instead, I have an object that contains either a box collider or a polygon collider for each tile, which then uses a composite collider for the final hitbox. This works really well, with no noticeable Physics2D calculations in the profiler.