I'm trying to create an array and keep it updated based on what objects are currently in a trigger. Here is what I have so far, the problem is that I am getting a null reference error when sending objEntering.gameObject to the augmentArray function.
function OnTriggerEnter(objectEntering : Collider)
{
objectsInTrigger++;
augmentArray(objectEntering.gameObject, fishInRange);
Debug.Log("Object name : " + objectEntering.gameObject);
Debug.Log("Obj in trigger " + objectsInTrigger);
}
function augmentArray(objToAdd : GameObject , array : GameObject[])
{
var tempArray = new GameObject[array.length+1];
for(i = 0; i < array.length; i++)
tempArray _= array*;*_
_*tempArray[array.length+1] = objToAdd;*_
_*// Refill the original array etc etc*_
_*}*_
_*```*_