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.

Question Button can be triggered through foreground objects

Discussion in 'Input System' started by ElFeuSchnegg, Jun 3, 2021.

  1. ElFeuSchnegg


    Feb 19, 2018

    I have a weird problem with a world space button. The pictures are from an example scene, just for simplicity.

    First Picture show the overview of the scene, consisting of:
    - a camera
    - a foreground object (red)
    - a button
    - a background object (rainbow)


    Now for my problem:
    When I click directly on the button (red area), all is fine, the button is activated as it should be.

    When I click on the red foreground object with the button behind it, there are two possible outcomes:

    If I click somewhere in the blue area, so with nothing behind the button, no click is registered on the button, so that works fine.
    Now for the weird part. If there is an object behind the button as in the yellow area, suddenly I can click through the foreground object, and the button is triggered.


    I am completely confused and really hope that anyone has an idea how to fix this...