I tried two methods:
IEnumerator ResetLevel()
{
yield return new WaitForSeconds(5f);
MissileLauncher.missileSpeed += 1f; // Change the value based on how much you want the speed to increase
// You can use SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex); if you want to reload the entire scene
SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex);
}
This one stopped at the yield return new line and the rest of the function wasn’t executed.
I tried the invoke line which never loaded the function:
void ResetLevelWithDelay()
{
Debug.Log(“Resetting with delay”);
Invoke(“ResetLevel”, 5.0f);
}