Search Unity

Event.delta problem of Unity3

Discussion in 'Editor & General Support' started by forest_linshs, Oct 11, 2010.

  1. forest_linshs

    forest_linshs

    Joined:
    Jan 6, 2010
    Posts:
    39
    Hello guys, I got a problem here. when I use Event.delta like this:
    Code (csharp):
    1. void OnGUI()
    2.     {
    3.         if(Event.current.type == EventType.MouseDrag  Event.current.button == 0)
    4.         {
    5.             Debug.Log(Event.current.delta);
    6.         }
    7.     }
    when I drag mouse, the delta's value is pretty fine. just like: (1.0, 2.0), (2.0, 3.0).......

    But when I build the program as a standalone, The EXE file is not work as it in Editor. the delta's value is much bigger, just like: (217.0, 158.0), (254.0, 159.0).....
    If you control objects rotation with mouse drag, This will be a big problem.
    So, I think this is a bug of Unity3 Building Event.delta.
     
  2. laurie

    laurie

    Joined:
    Aug 31, 2009
    Posts:
    638
    Are you sure it's not just a factor of screen resolution? If you scale the delta by the screen width/height, are the results still inconsistent?
     
  3. pointer

    pointer

    Joined:
    Oct 9, 2010
    Posts:
    7
    I have the same problem.
    Im using 1024x768 as native resolution in unity editor and webplayer.
    The editor throws the correct delta and the webplayer throws the screen mouseposition. Oo
     
  4. Djik

    Djik

    Joined:
    Jul 13, 2010
    Posts:
    19
    Hi,

    We also met the problem here. Has someone found any solution?

    We got this while event.delta isn't fixed.

     
    Last edited: Oct 25, 2010
  5. andeeeee

    andeeeee

    Joined:
    Jul 19, 2005
    Posts:
    8,768
    Please can you file a bug report for this (menu: Help > Report A Bug).
     
  6. luckycpp

    luckycpp

    Joined:
    Dec 1, 2010
    Posts:
    2
    Add me to the list of experiencing this problem. Everything with the delta works great in the editor. As soon as we build a windows stand-alone, the delta is out of whack.

    I am new to Unity, and jumping on an existing project, so I am not sure if this problem is something we caused. After seeing this post I would check in and see if there has been a resolution.

    After doing some logging; it appears that on our windows stand-alone build the Event.current.delta is the same as the Event.current.mousePosition. We are using Unity 3.1
     
  7. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,601
    It shouldn't be a big problem as you should NEVER do input handling in ongui, better use Input.xxx and the update function. This will be more lightweight and much more straight forward than clobering the gui function with interaction thats independent of the UI
     
  8. luckycpp

    luckycpp

    Joined:
    Dec 1, 2010
    Posts:
    2
    At least for the windows stand-alone build, I have narrowed down when the Event.current.delta gets clobbered when the GUI.matrix setter gets called. To work around the issue, I manually recalculate the delta and reset it after GUI.matrix is set, and it cleared up our problem. Again though, in the editor everything works great, this only happens in the stand-alone build.
     
  9. met44

    met44

    Joined:
    May 3, 2011
    Posts:
    2
    Hi, this is still going on (v3.3.0f4) and by the way, in the standalone the delta given by event is the actual mouse position...
     
  10. Draco18s

    Draco18s

    Joined:
    Aug 15, 2011
    Posts:
    110
    I also experience this issue. Unity 3.3.0f4
     
  11. CgShady

    CgShady

    Joined:
    Mar 31, 2011
    Posts:
    10
    I am experiencing the same issue. This is only happening on windows builds. OSX builds run fine.
     
  12. CgShady

    CgShady

    Joined:
    Mar 31, 2011
    Posts:
    10
    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 !
     
  13. kjslack

    kjslack

    Joined:
    Apr 27, 2009
    Posts:
    11
    This problem still exists in 3.4.2f3, and was introduced into our projects when we updated the projects from 2.6 to 3.4.

    The issue of a strange delta value only occurs on Windows builds and not in the editor or mac builds.
     
  14. LiorBa

    LiorBa

    Joined:
    Aug 6, 2019
    Posts:
    18
    still happens in windows standalone. in 2020!