Search Unity

Prevent event (click) propagation on a button

Discussion in '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

    Drink more water! Unity Technologies

    Joined:
    Jan 16, 2011
    Posts:
    4,657
    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:
    39
    @superpig is there an updated 2019 answer to this?
     
  5. superpig

    superpig

    Drink more water! Unity Technologies

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