- Home /
Unity 2D Make An Object Disappear On Click
Hi i would like to have a script to make this object disappear. I am making a Jeopardy game for school and i would like to have it so I can click the question and it disappears, revealing an answer behind it. Im new at this so please bare with. I would also like to have it so with the first click it zooms onto the question, then deletes the object on a second click, revealing the question, and then after a third click it zooms out again, but I know this is hard, and involves multiple cameras so its not needed in the least bit. thanks for helping me out. here is what I have so far:
using UnityEngine; using System.Collections;
public class remove : MonoBehaviour {
// Use this for initialization
void start () {
function OnMouseDown()
{
gameObject.active = false;
//Destroy(gameObject);
//renderer.enabled = false;
}
}
}
Your answer
![](https://koobas.hobune.stream/wayback/20220612042500im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
How to make on/off-like gui-button? 3 Answers
Button only works once 1 Answer
Can anyone help with loading issues when button is clicked? 0 Answers
[C#] Both button check with delay. 1 Answer