- Home /
delay "after mouseclick"
hey guys! i have an object which is auto-spinning and you can rotate it around the y-axis by draging it. i want to have an delay of 10 seconds; so whenever i drag the object and rotate it, it should stop 'auto-spinning' for 10 seconds and then go on normally with the auto-spin. here is the script:
 using UnityEngine;
 using System.Collections;
 
 public class tes01 : MonoBehaviour
 {
     // Use this for initialization
     void Start()
     {
 
     }
 
     // Update is called once per frame
     void Update()
     {
         transform.Rotate(new Vector2(Time.deltaTime * 0f, 0.05f));
 
     }
 
     float rotSpeed = 8;
 
     void OnMouseDrag()
     {
         if (Input.mousePosition.y < Screen.height / 2)
         {
             float rotX = Input.GetAxis("Mouse X") * rotSpeed * Mathf.Deg2Rad;
             transform.RotateAround(Vector2.up, rotX);
         }
     }
 }
any ideas of how i could do this? would really thankful if you could give me a finished script for that because i'm new to c# - thank you!
Your answer
 
 
             Follow this Question
Related Questions
Adding a delay for weapon switching 1 Answer
(URGENT) I have a swinging axe I can get to rotate once in 1 direction but i need it to loop 3 Answers
Why when using get; set; in one script i'm getting null in other script that use it ? 1 Answer
How to rotate my player with the gamepad right stick ? 0 Answers
[C#] Quaternion Rotations with Input.GetAxis problems. 1 Answer
 koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                