- Home /
Moving a RigidBody2D for a certain period of time?
Hello everyone, I'm trying to move a rigidbody for a certain period of time, but I'm having trouble with the timer. This is the script:
Basically, I see in the Inspector that seconds always starts at a value slightly bigger than 2, making the do-while loop useless. This also happens if I put in a different number (for example, if I put 4, seconds starts at a value slightly bigger than 4). Consequently, the rigidbody velocity is immediately set to 0 and it doesn't move. It might be useful to know that I'm working in a StateMachineBehaviour in the OnStateUpdate method. I really can't understand what I'm doing wrong, but I'm fairly new to Unity, so the solution might actually be very simple. Thanks!
Your answer
Follow this Question
Related Questions
Only make a timer work while an object has velocity 1 Answer
Minute Timer Issue 1 Answer
How do I make my character's movement less floaty? 1 Answer
How to make the enemy stops according the player position 1 Answer
Game Timer help needed 2 Answers