- Home /
(New UI) 3D objects as buttons?
Hi!
I am trying to make a Tower Defense game and I want buttons to be the towers as 3D objects. But I can't get it to work. In the editor, it follows the UI animations and seems to work. But in the game scene, it is gone. Do anyone know how to do this?
Thanks
Comment
Answer by killerstreak · Aug 27, 2014 at 05:22 PM
any gameobject can be made clickable with a simple piece of code..
OnMouseDown is a premade function by unity. It fires when the gameobject wich the script is connected to is clicked.
just add it like this :
function OnMouseDown()
{
//whatever you want to happen when tower is clicked
}
I use On$$anonymous$$ouseDown a lot, because I don't like Unity's GUI. It works with Touchscreens, too.
That isn't the problem. $$anonymous$$y problem is that is doesn't want to show up on the UI.