how do i go about finding a game object then transforming its position to move forward if a condition is met
like the condition is 5 so move forward 5 places .
i have tried many codes to do this but none have worked .
thanks in advance =]
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.
bad news , I still have not gotten it to work .
and yeah it is c#
I haven’t tried fixing it again because in busy with other scripts
but i will let you know whats going on as soon as i get back to it .