Question by
unity_0Rw3Pu7yoY53dw · Oct 13, 2018 at 01:48 PM ·
2d gamedestroy objectreferencing
How can I make a script that will destroy a gameobject I click/tap when certain ui button is pressed down?
I'm making a easy game for my elementary school math students. This game will have buttons, and these buttons will have an equation as a text in them. Then I'm spawning bunch of gameobject with different possible answers and students should be able to destroy these gameobjects by pressing down a button with correct equation to match it's answer, and while pushing this button they should be able to destroy this gameobject with correct answer by tapping it.
In unity, am I able to make a one destroy script for these gameobject that will also check if the correct button is pressed? And how do I refer to these UI buttons in my script?
Comment