Subject says it all. How do I get the tile position that's under the mouse in the scene view?
My current attempt looks like this:
void OnSceneGUI(SceneView sceneView)
{
Event e = Event.current;
int xx, yy;
if (e.type == EventType.MouseDrag && e.button == 0 && e.isMouse)
{
tileMap.GetTileAtPosition(tk2dCamera.Instance.camera.ScreenToWorldPoint(e.mousePosition), out xx, out yy);
}
}
Unfortunately, the world position from the camera changes anytime I pan and is completely different from the tile map world position. For example, even though my mouse is over tile (0,0), xx and yy depends on the position of the camera.