Hi, in last two days i have begin to program in C# and try to create arrays. So my question is pretty simple: How can I program to detect a collision with my first GameObject of array. Like this:
using UnityEngine;
using System.Collections;
public class InOutVehicle : MonoBehaviour {
public GameObject[] EnterCollider = new GameObject[0];
// I remove other irrelevants parts of script, so that's it
void OnCollisionEnter(Collision col)
{
if(col.gameObject = EnterCollider[0] )
{
if(Input.GetKeyDown(KeyCode.E))
{
//Do Stuff
}
}
}
}
//Sorry for english, I’m from Brazil;