Hi, how can I use raycast to create an array of gameobjects to access later on? Something like this-
using UnityEngine;
using System.Collections;
public class transformation : MonoBehaviour {
public LayerMask touchinputmask;
public GameObject [] objects;
void Start () {
}
void Update () {
Ray r = new Ray(transform.position,Vector3.Up,100,touchinputmask);
RaycastHit[] hits = Physics.RaycastAll(r,100,touchinputmask);
foreach(RaycastHit hit in hits)
{
objects=hit.collider.tag;
}
}
}