am doing a space shooter game. when the game begins i want the player to have some time 1 or 2 seconds to warm up so that he checks the controls and then want to spawn the enemies.
how to achieve this.
You can do it by calling a coroutine yielding WaitForSeconds as a first instruction, and calling your spawn function after it.
Alternatively, when player clicks “Start”, you can store current Time.realtimeSinceStartup value in a gameStartTime variable, and check in Update if actual Time.realtimeSinceStartup minus gameStartTime is greater than for example 2. If yes, you should spawn enemies and disable above check by using additional boolean variable (or eventually setting gameStartTime to float.MaxValue).