Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

GetMouseButtonDown() problem in New UI System

Discussion in '2D' started by siceblue, Aug 26, 2014.

  1. siceblue

    siceblue

    Joined:
    Apr 21, 2014
    Posts:
    3
    when i click the button in new ui system, the GetMouseButtonDown(0) function in update will be invoked, how can i prevent this??? thanks~~
     
  2. Punchbag

    Punchbag

    Joined:
    Oct 30, 2012
    Posts:
    48
    Add code that uses a Ray to figure out what was clicked and if the clicked item was a GUI element, does nothing.
     
  3. StarManta

    StarManta

    Joined:
    Oct 23, 2006
    Posts:
    8,773
    You need to use !EventSystemManager.currentSystem.IsPointerOverEventSystemObject()
     
  4. siceblue

    siceblue

    Joined:
    Apr 21, 2014
    Posts:
    3
    thanks very much,it is right way