Search Unity

  1. We're looking for feedback on Unity Starter Kits! Let us know what you’d like.
    Dismiss Notice
  2. Unity 2017.2 beta is now available for download.
    Dismiss Notice
  3. Unity 2017.1 is now released.
    Dismiss Notice
  4. Introducing the Unity Essentials Packs! Find out more.
    Dismiss Notice
  5. Check out all the fixes for 5.6 on the patch releases page.
    Dismiss Notice
  6. Help us improve the editor usability and artist workflows. Join our discussion to provide your feedback.
    Dismiss Notice

How to get mouseposition in scene view?

Discussion in 'Scripting' started by jwyoo_stone, Nov 5, 2013.

  1. jwyoo_stone

    jwyoo_stone

    Joined:
    Jul 15, 2012
    Posts:
    12
    I tested, lnput.mousePosition only work in gameview weather edit or run mode.
     
  2. rutter

    rutter

    Joined:
    Mar 21, 2012
    Posts:
    84
  3. jwyoo_stone

    jwyoo_stone

    Joined:
    Jul 15, 2012
    Posts:
    12
    Thanks,I'v got it;
    First I do a crazy thing
    use user32.dll API,Find the window handler,then get the client rect and globale mous postion. at last it works!
    but use
    Editor.OnSceneGUI() ,
    Event.current,
    are vary easy to reach this.
     
  4. JudeJohan

    JudeJohan

    Joined:
    Nov 4, 2014
    Posts:
    1
    Bump, how did you manage to do this? Literally zero info of this on interwbz:(
     
  5. wuzibu

    wuzibu

    Joined:
    Dec 15, 2014
    Posts:
    8
    Last edited: Oct 3, 2015
    Xaon and glitchers like this.
  6. glitchers

    glitchers

    Joined:
    Apr 29, 2014
    Posts:
    42
    Xaon and rakkarage like this.
  7. Dmsotir

    Dmsotir

    Joined:
    Feb 12, 2013
    Posts:
    43
    what kind of script does this go in? editor script? I cant seem to get it to work. its saying Event.curent.mousePosition is null...
     
  8. glitchers

    glitchers

    Joined:
    Apr 29, 2014
    Posts:
    42