Aiming gun where camera is pointing

How can I aim my weapon at the point where a ray, cast by my camera hits?

You can make the transform point at the raycast’s hit point using transform.LookAt:-

var hit: RaycastHit;
   // Perform raycast...

gun.transform.LookAt(hit.point);