Some coding help needed

Hey everyone, I am fairly new to coding and am looking for some help on a few issues.

Basically I am making a game thats an endless runner and am having issues with

  1. On start I have a countdown animation, but I can not get my object to wait for 4 seconds before taking off down the map. The only controls on the Player is left and right. It is coded so that it continues down the map automatically and the user will only have to swipe left or right to control the object.

  2. I also cannot figure how to play an exploding animation when it crashes. It just disappears and the game goes back to the scene and says MissingRefererenceException

Any help would be greatly appreciated! Thanks everyone for looking!

  1. To wait for 4 seconds, what you can do is make your Time.timeScale = 0, this will pause all the scripts. And start a Coroutine with WaitForSecondsRealtime, (Don’t use WaitForSeconds as this is Time.timeScale dependent - so not good for your case )

    void Start()  {
         Time.timeScale = 0;
         StartCoroutine(InitialWait(4.0f));    //Time you want to wait in seconds.
     }
     
     private IEnumerator InitialWait(float waitTime) {
                yield return new WaitForSecondsRealtime(waitTime);
                Time.timeScale = 1.0f;
     }
    
  2. You can use existing assets from Asset store for your exploding animations. There are tons of freely available, just explore. Have a look at : Freely Available assets.