Hello everyone,
For some reason, saving a gameobject in an array is not working for me. Granted, I have never worked with arrays before, but I can’t find what I am doing incorrectly. My code is this:
using UnityEngine;
using System.Collections;
public class createContact : MonoBehaviour {
public GameObject newContact;
public Vector3 NEWcontactSpawn;
public int contactCount;
int i = 0;
public GameObject[] ContactArray;
//declare variables
void Start ()
{
ContactArray [4] = newContact;
}
and I get an error stating that the array index is out of range. The gui array interface in unity says that the array is 0 items long. I am not sure what is wrong here. Thank you for the help.
Sincerely,
Wolfshadow