Restarter.cs 378 B

1234567891011121314151617
  1. using System;
  2. using UnityEngine;
  3. using UnityEngine.SceneManagement;
  4. namespace UnityStandardAssets._2D
  5. {
  6. public class Restarter : MonoBehaviour
  7. {
  8. private void OnTriggerEnter2D(Collider2D other)
  9. {
  10. if (other.tag == "Player")
  11. {
  12. SceneManager.LoadScene(SceneManager.GetSceneAt(0).name);
  13. }
  14. }
  15. }
  16. }