Help Needed Post
In my platformer game, I’m using CompositeCollider2D to group the tiles’s collider. The GetPath() method allows to return the points that makes up the collider (path). However, I’m having difficulty identifying the Path Index, which is required by the GetPath() method.
I can do a loop on all the path, and loop through all the points to find the closest one to my player. But there’s got to be a more efficient way of identifying the index of a particular platform/collider right? (imagining having hundreds of separated platform).
The unity documentation for GetPath() explains how to use it, but doesn’t explain how to identify the index of a particular platform.
Currently, all my tiles are drawn on the same tilemap, and uses the same tilemapCollider and CompositeCollider2D, my main issue is how to know the path Index of the platform that my player is currently on.
Any idea?