Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. 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,738
    You need to use !EventSystemManager.currentSystem.IsPointerOverEventSystemObject()
     
  4. siceblue

    siceblue

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