- Home /
MouseDrag() stops working
I have the following piece of code attached to a cylinder, and it works fine, but every time I run it for some time (a matter of seconds), the On MouseDrag() stops working, not detecting my dragging. Any clues?
Thanks!
static var strength : float; static var oldMouse: float;
function OnMouseDown() {
oldMouse = Input.mousePosition.y;
}
function OnMouseDrag(){
transform.Rotate( Vector3(strength,0,0) * Time.deltaTime );
} function Update () {
strength = (Input.mousePosition.y - oldMouse);
}
Thanks a lot!
Answer by morothar · Feb 17, 2010 at 03:29 PM
If I were you I'd message unity with a detailed bug report, there's not much you could do to fix it as far as I know.
If I were you, I'd program my own mouse handling for this. Check your mouse position and it's button states in Update(). It's not much coding to do and it will enable you to do your dragging stuff.
Your answer
![](https://koobas.hobune.stream/wayback/20220612063244im_/https://answers.unity.com/themes/thub/images/avi.jpg)