how do i transform the position of a game object IF a condition is met
e.g
if if (Value== 4)
{
GameObject.find (“box”);
// I also need to transform (box) its position and move it forward for 4 seconds
}
I have an idea of what to do but nothing I try works
would you please help me solve this problem.
system
2
if(Value == 4){
Boxobj = GameObject.FindWithTag(“box”);
move = true;
}
if (move == true){
while(Value > 0){
Boxobj.transform.position = transform.forward * 10;
Value --;
}
if(Value == 0){
move = false}
}
You need a GameObject that is called Boxobj and a bool that is called move.
I came up with this really quickly so there might be some errors.
PS. Dont ask people to write code for YOU.