I’ve seen a few threads which are similar to this, but nothing is quite what I need. What I’m trying to make is a Handle/Gizmo-based editor in the sceneview, where you can click on the Tiles of a grid of squares, and in that way put down floor tiles or do other things.
I’ve made a grid and am iterating through it with two simple ‘for’ loops (for x and y coordinates). I’m drawing the grid with DrawSolidRectangleWithOutline as this seemed to be the only way to make a 2D grid in 3D space.
When I click or hover on the grid somewhere I want to send the x and y coordinates of the Tile to go into a function. This would for example change the color of the tile so it can be seen it is hovered, or spawn a floor tile at that position.
With raycasting (using GUIPointToWorldRay) I have to add a colider, resize according to the gridsize and then get
hit.point. This sort of works but now I have an extra component to deal with etc.
Is there a better way to do this? I’m not so familiar with Handles and Gizmos but possibly there is something here which I have simply not found. Any references or tutorials would be appreciated.