im making a RTS and would like to find where the mouse is pointing so that I can place a building there ive tried raycasting and it seems to not work any suggestions?
void Update () {
float hit;
Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
if (plane.Raycast(ray, out hit))
{
Transform objectHit = hit.GetPoint(hit);
Debug.DrawRay(transform.position, objectHit.position, Color.red);
}
}