Search Unity

  1. We would like to hear your feedback about Unity and our products. Click here for more information.
    Dismiss Notice

Prevent event (click) propagation on a button

Discussion in 'Unity UI (uGUI) & TextMesh Pro' started by miskomare, Sep 2, 2014.

  1. miskomare

    miskomare

    Joined:
    Jan 14, 2014
    Posts:
    5
    Hi there,

    I have a canvas with one button, which has OnClick() function. The canvas is above some of my other objects and it uses Screen Space - overlay rendering mode.

    When I click on the button, OnClick() is executed, yet the elements beneath the button also get clicked.

    Any ideas how to prevent this?

    Thanks!
     
  2. superpig

    superpig

    Quis aedificabit ipsos aedificatores? Unity Technologies

    Joined:
    Jan 16, 2011
    Posts:
    4,154
    Please read the FAQ.
     
  3. miskomare

    miskomare

    Joined:
    Jan 14, 2014
    Posts:
    5
    Thanks superpig!
     
    Lu27 likes this.
  4. tmendez

    tmendez

    Joined:
    Oct 12, 2015
    Posts:
    25
    @superpig is there an updated 2019 answer to this?
     
  5. superpig

    superpig

    Quis aedificabit ipsos aedificatores? Unity Technologies

    Joined:
    Jan 16, 2011
    Posts:
    4,154
    Not to my knowledge.
     
    tmendez likes this.