ForcedReset.cs 471 B

123456789101112131415161718
  1. using System;
  2. using UnityEngine;
  3. using UnityEngine.SceneManagement;
  4. using UnityStandardAssets.CrossPlatformInput;
  5. [RequireComponent(typeof (GUITexture))]
  6. public class ForcedReset : MonoBehaviour
  7. {
  8. private void Update()
  9. {
  10. // if we have forced a reset ...
  11. if (CrossPlatformInputManager.GetButtonDown("ResetObject"))
  12. {
  13. //... reload the scene
  14. SceneManager.LoadScene(SceneManager.GetSceneAt(0).name);
  15. }
  16. }
  17. }