Delta event out of Editor Problem

Hi,im using Event.Current.delta to move a texture arround the screen. The problem comes when i build the scene. Current delta goes crazy and doesnt stop never.

If i stop moving the mouse texture keeps mooving on the last direction.

Thanks

We may need to see some code to answer this one. But my first guess would be that you are not checking the Event.type field. I think that your code in OnGUI is getting called at fixed intervals (to draw GUI elements, perhaps) and you are treating each one as if the mouse had moved. If so, try limiting your code to Event.type==EventType.MouseMove. But, you will need to draw your texture regardless- the question is whether to draw it at the same location as last time, or whether to move it to a new location.

Is this texture supposed to be acting like a mouse cursor? If so, you may not need the delta at all, just read the Input mousePosition, as described in: this answer.

I go crazy using Delta to drag objetcs so i change textures my planes and now i have it done. The problem should be that delta coult be used out of Unity editor because on editor all works well.

Let me add to this. It works “out of the editor” on MacOSX platform, but not on Windows.
My experience is the exact same as described above, I’m using the delta on a MouseDrag event, so I am checking the event type, and I’m using it to let the user zoom with a mouse drag with the right mouse button.

It works in both MacOSX and Windows versions of the editor, it works in the OSX compiled app. It just doesn’t in the executable version on windows.
I did some printing on the screen and can confirm that Event.current.delta == Event.mousePosition, but again only on windows compiled project.
I tried to make my own mechanism to compute delta, storing previous value, etc… And guess what, it works in the editor, but not in the compiled version. I feel there’s some deeper bug on the event mechanism on windows builds.

All, I just found a workaround. I was using Event.current.delta.y to zoom in and out with the right mouse button.

As it doesn’t work on Windows builds, I am now using Input.GetAxis(“Mouse Y”). That works OK, I simply had to changed the sensitivity, as this one isn’t given as a pixel delta, but seems to be using the mouse Dpi and speed settings.

Here’s the code for reference :

if (Event.current.type == EventType.MouseDrag && Event.current.button == 1)
	{
//		Camera.main.fieldOfView += Event.current.delta.y/10;
		Camera.main.fieldOfView += Input.GetAxis("Mouse Y");
	}

Hope this helps !