I am using Unity 2019.2.8f1 and experiencing weird results when I try to disable a game object. I have an object with a Sprite Renderer, Polygon Collider 2D, and a custom script. In the OnMouseDown handler in the script, I disable the gameObject by calling: Code (CSharp): this.gameObject.SetActive(false); . When I play the scene, sometimes I have to click on the object twice before it will disappear. Other times, it will never disappear. If I disable the object manually in the inspector, the object is still displayed. It seems that there is a problem with the Unity editor/player. Has anyone experience this problem? To troubleshoot this problem further, I created a new Unity project with just a game object in the scene. Everything works as expected. The object disappeared when I clicked on it the first time.
Try creating a variable for your game object you want to disappear. Code (CSharp): public GameObject yourObj; // Then in your MouseHandlerDown() yourObj.SetActive(false); Tell me if this works. If not, show more of your code so I can analyze your issue.