As the title speaks for itself, I'll explain it more properly.
I have an array wich contains positions of certain objects. I don't want to keep pushing more and more of the same objects in the array so I put the push in a Start function. But now the positions in the inspector (from a Vector3 array wich is filled with the normal array) arentio't changing. Obvious cause its in a Start function.
Now for the question: How can I push these objects in the array, and then keep the positions updating?
Help is really appreciated :) Thanks in advance!
For those who need the script:
//This script is created and made by Freel4tte.
//Anyone who uses this script illigal or without permission will
//get hunted down by zombies on tricycles and ninja bears with laser eyes.
//You have been warned.
var filteredEnemies = Array(); //all other objects
var posEnemies = Array(); //positions of other objects
var showEnemies : GameObject[];
var getPos : Vector3[];
@HideInInspector
var enemies : GameObject[];
function Start(){
seeEnemies();
}
function Update(){
getPos = posEnemies;
}
function seeEnemies():GameObject{
enemies = GameObject.FindGameObjectsWithTag("enemy");
for (var currEnemy in enemies){
if (currEnemy == gameObject)
continue;
filteredEnemies.Push(currEnemy);
posEnemies.Push(currEnemy.transform.position);
}
showEnemies = filteredEnemies;
}