- Home /
Question by
Tofudude624 · Jan 02, 2012 at 06:54 PM ·
transformdestroy
Script problems...
Hello. I dont know why this script is not working. First I want to store an object's position. After a few seconds, I want to check to see if the object has moved, and if it has, destroy it. For some reason, the object is not destroying itself(even though it's position is different from the "space" variable)...why?
var space: Vector3;
function Start(){
Invoke("Setup",1);Invoke("Check",3);
}
function Setup(){
space=transform.position;
}
function Check(){
if(space!=transform.position){
Destroy(gameObject);
}
}
Comment
Best Answer
Answer by naf456 · Jan 02, 2012 at 07:04 PM
Beats me... Have you tried Debugging it, IE, set-up print functions to make sure the functions are firing right, and test if the object is actually destroyed with the Destroy() function...