Advertisement
Guest User

Untitled

a guest
Jun 28th, 2016
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. void OnCollisionEnter2D(Collision2D col){
  2.  
  3. if (col.gameObject.tag == "Enemy") {
  4.  
  5. score = score + 50;
  6. Destroy (gameObject);
  7. *Here I need to wait for 3 sec then it should load the next level*
  8. SceneManager.LoadScene(nextLevel);
  9.  
  10. void OnCollisionEnter2D(Collision2D col){
  11.  
  12. Debug.Log ("Collision");
  13.  
  14.  
  15. if (col.gameObject.tag == "Enemy") {
  16.  
  17. score = score + 50;
  18. Destroy (gameObject);
  19.  
  20. StartCoroutine (WaitForIt (3.0F));
  21.  
  22. IEnumerator WaitForIt(float waitTime) {
  23. yield return new WaitForSeconds(waitTime);
  24. SceneManager.LoadScene(nextLevel);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement