I have a script that might be able to do that.
var aGameObject : GameObject; //you don't have to define this in the inspector
var move : float = 5; //the amount to move
function Start () {
if (move == 5) { //the condition needed to move
aGameObject = GameObject.Find("NameOfObject"); //find that GameObject by its name
aGameObject.Translate(Vector3.forward * Time.deltaTime * 5); //move it 5 spaces in the z - axis
}
}
I haven't tested it but it should work. Let me know if you get any errors.
↧