I have a gameobject and I want it to move down for 0.5 seconds every 1.5 seconds (something like a movement “cooldown”). I know I´m missing the 0.5s but I´m kinda new to Unity and I don´t know how to apply it. (As extra info the game is 2d)
Hope I can get an answer
void Update()
{
_speed=0.0f
StartCoroutine(Move());
transform.Translate(Vector3.down * _speed * Time.deltaTime);
}
IEnumerator Move()
{
_speed = 2.0f;
yield return new WaitForSeconds(1.5f);
}
}