Placing an item with a mouse click on the map

Hey all, I am very new to Unity and I've learned most of the basics around in the many tutorials. I am an amateur game designer and 3D artist so scripting is sort of new to me. I've been using the last 2 days running through scripting tutorials for Unity, but I still have some questiosn regarding point and place. I've found out how movement works and how to get things to follow you and etc. But the fact of pointing and placing and item with you mouse click is still a riddle for me for some reason. Are there anyone here who know of such a tutorial or can someone help me a bit on the way? PS. im a quick learner :)

Essentially what you need to do is cast a ray from the camera in the direction of your mouse pointer, and then use the RaycastHit to obtain the position.

Something like this should work (untested C#)

private Vector3 GetObjectPosition()
{
    Vector2 pos = Input.mousePosition;
    Ray ray = camera.main.ScreenPointToRay(new Vector3(pos.x, pos.y, 0.0f));
    RaycastHit hit;
    Physics.Raycast(ray, out hit);
    return hit.point;
}

Then just instantiate your object at that point using the Instantiate function. Note that you'll need to attach a MeshCollider to your map so that the ray can hit something :)

Hey there, thanks alot for the answer, I will try it out as soon as possible. And thanks for the description, let's me know how to think when it comes to programming.

Thanks alot