- Home /
How to Disable Boxcollider2d when game is paused.
Hello. Im Making a hidden objects game on unity 2d, and i used boxcollider2d to traget clicks on objects( for an example i used a star as a hidden object and used a boxcollider2d for whenever i ckick on the star it disapears) and i created a puase menue in canvas with buttons . the pause menue works but if i pause the game the boxcollider doesnt get disabled . so if i pause the game and click on the star it still disapears. Can you please help me ,i want to disable all the boxcolliders when i pause the game.
Answer by Earthshine · May 20, 2021 at 08:26 PM
You don't actually need to disable the colliders.
You can check if game is paused in objects' OnMouseDown() functions instead.
Or you can add a transparent panel with 'raycast target' between menu and objects. Objects should be be above it in the hierarchy and menu items should be below.
Your answer
![](https://koobas.hobune.stream/wayback/20220613034002im_/https://answers.unity.com/themes/thub/images/avi.jpg)