I am working on an isometric 2D terrain generation with which I want to be able to interact with the mouse later.
I am creating all the GameObjects within a script and need the tiles to have a Polygon Collider 2D for the mouse interaction. I am far from satisfied with the mesh Unity creates for each tile and want to edit them manually.
I do know that I could create a Prefab and edit the Polygon Collider there but I want the colliders to be as precise as possible so that there are no holes and no overlaps in the final terrain and the best way to do that is by placing them in a script with precise coordinates.
I have attached an image with three current phases I am encountering. The first kind(left) happens when I create the GameObject with a script and add the Polygon Collider 2D as a component. The second one(top right) is when I throw the sprite into the scene myself and add the Polygon Collider 2D in the Inspector.
And the final one(bottom right) is the way I want it to be only the gras should be seen as a collider.
I have started to access the Polygon Collider 2D component in a script but can’t think of a way check for current placement of the vertices of the collider mesh or how to edit them.