title: Wait for some seconds before it executes further code in UNITY?
body: <p>So i have tried doing this :</p>
  <pre><code>void Update()
      {
          if (isWalkingTowards)
          {
              if (Vector3.Distance(character.transform.position,this.transform.position)&lt;0.7)
              {
                  **StartCoroutine(Example());**
                  Instantiate(character, new Vector3(-6, 0, -1), Quaternion.identity);
                  Destroy(character);
  
              }
          }
      }
      **IEnumerator Example()
      {
          yield return new WaitForSecondsRealtime(5);
          Debug.Log(&quot;This function should be read before it is instantiated or destroyed&quot;);
      }**
  </code></pre>
  <p>But it just instantiates and destroys object and after that it shows me that message!</p>