Question by
stephanlevin · Jul 13, 2017 at 07:04 AM ·
scripting problemscripting beginnerdelayscritping
script an delay
hey guys! i found a script for auto-spin and rotate-by-drag., 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);
}
}
}
would be really thankful for finished scripts, because i have no experience with c# or java. thank you!
Comment
Your answer
Follow this Question
Related Questions
script delay ("on mouseclick") 0 Answers
hide object with mouse enter 0 Answers
HELP! How to make Update function start after delay? C# 2 Answers
How to disable raycast/groundchecker on OnTriggerEnter? 0 Answers
random spawn enemy problem 0 Answers