I am trying to send out a raycast, so when the player clicks on the terrain, an object would be placed right where the player is looking.
if(Input.GetKeyDown(KeyCode.Mouse1) && saplings != 0) {
RaycastHit hit;
Ray ray = camera.ScreenPointToRay(Input.mousePosition);
saplings--;
//Place object
}
what piece of code could I use to place the object?
One way is to use Physics.Raycast with that ray and if the ray hits something, the RaycastHit structure will be filled out with the point, and you can use that to know where to place the object. There are plenty of examples of this around on the net, just google for Physics.Raycast examples, I won’t bother to type a fresh one here. 
Vector3 fwd = transform.TransformDirection(Vector3.forward);
if (Physics.Raycast(transform.position, fwd, 10)) {
Instantiate(saplingObject,transform.position,Quaternion.identity);
Now, how to I make it so I place it where im looking, not where im standing? I found this on google, but it only works when i look at any object thats NOT the terrain. How do I make it work when I ONLY face the terrain?