I have a script that works but it does not do what I want it to do. My script makes an object rotate on when another is clicked. However, I want the object to continuously rotate until I click on the other object again. Right now when I click it rotates just a bit and stops.
Here is my script:
public class Rotate : MonoBehaviour {
public float speed =50f;
public GameObject target;
public void OnMouseDown(){
target.transform.Rotate (new Vector3(0, Time.deltaTime, 0) * speed);
}
}
How can I make the object rotate continuously until I click it again?
No comments:
Post a Comment