How to stop gameobjects from being clickable through a wall

I am fairly new to unity and just trying to figure out how to stop gameobjects from being accessible through walls.
any help would be greatly appreciated.

image above shows that a door is closed and you need to find a key to unlock the door. once you unlock the door a waypoint is there for a player to click. the problem is that the waypoints are clickable through the wall which defeats the purpose of the locked door. I tried googling but cant seem to find a proper solution.

Hi @brichard0625
Firstly your picture isn’t public – DropBox change maybe? The forum accepts picture uploads and this helps posts stay looking good.

Obviously without the pic this is just a guess but could it be that you’re using physics raycast and forgot to include the door’s layermask? Or you’re using unity UI with Graphics Raycaster and haven’t set the blocking layer mask? Or,… yeah there could be several options but maybe start there :slight_smile:

updated the picture. Still having this issue. I tried googling layermask and tried a few things but still getting the same issue. I am using a gvr pointer physics raycaster.

I want to make this question as answered. I simply just had to add a boxcollider to the wall.