I’m trying to make a variable within my raycast script that store the GameObject you are locking at. This is my script
var HitStore : GameObject;
function Update ()
{
var hit : RaycastHit;
var ray : Ray = Camera.main.ScreenPointToRay(Vector3(Screen.width*0.5, Screen.height*0.5, 0));
if (Physics.Raycast (ray, hit, 60))
{
if (hit.collider.gameObject.tag == "WaterStore")
{
HitStore = hit.gameObject;
if (Input.GetKeyDown(KeyCode.E))
{
hit.transform.SendMessage("MoveWater", SendMessageOptions.DontRequireReceiver);
}
}
}