Im trying to do somethin like this
if (Input.touchCount == 1)
{
if (Input.GetTouch(0).phase == TouchPhase.Began)
{
var ray = Camera.main.ScreenPointToRay(Input.GetTouch(0).position);
var hit;
if (collider && collider.Raycast(ray, hit, 100.0))
{
OnMouseDown();
}
}
}
But var hit; complaines that it need to be instanziated. How would i do that?