Use Input.MousePosition to find location on Map?

Hey, so I’m trying to make a top-down turn-based strategy game. The way I plan on determining which province is being selected is I’ll have a plane below the visible map which has each province filled in with a specific color. Then, the player will be clicking on this ColorMap instead of the visible one. However, I need a means of determining what color is being clicked on.

I’ve been trying and failing to get RaycastHits to work in detecting the pixel locations being clicked on so I can then use colorMap.GetPixel(). However, I was wondering if just using Mouse Position (or onMouseDown) could work for that as well? Thanks!

Try this:

Ray ray = Camera.main.ScreenPointToRay (Input.mousePosition);
RaycastHit hit;
Vector3 pointYouNeed;
if (Physics.Raycast(ray, out hit))
{
    Debug.Log ("Hit something!"+hit.collider.name);
    pointYouNeed = hit.point;
}

If you want to see code that shows how to use RayCasts with mouseButtonDown, I wrote some code for another problem here: Click object to open pdf - Unity Answers (be sure to scroll down as there were a few edits required after the initial post, but the end result worked)