Okay I know this is such a long winded way of writing it but I gave it a go, could anyone possible explain how I can simplify this whole piece of script.
To explain what I'm doing: I have two game objects that are instantiated at different points in my game, both scale from 0.01 to 1.00, I want the script to recognize when both objects have been instantiated and when they're both full scale.
var runonce = false;
var runagain = false;
var objectAdd = false;
var fullScaleObject = 0;
function Update(){
var objectCount : GameObject[] = gameObject.FindGameObjectsWithTag("myObject");
if(objectAdd){
addAnObject();
}
if(fullScaleObject == 2){
Debug.Log("COMPLETE");
}
if(objectCount[0].transform.localScale.y >= 1.0){
if(!runonce){
addAnObject = true;
runonce = true;
}
}
if(objectCount[1].transform.localScale.y >= 1.0){
if(!runagain){
addAnObject = true;
runagain = true;
}
}
}
function addAnObject(){
fullScaleObject += 1;
objectAdd = false;
}
Thanks - C