uGUI Button without renderer

I need to have a uGUI (new UI) Button that functions without an image, or text, or any kind of visible object on it.

Currently, I can only get a button to work if it has an image or text attached or as a child. Has anyone managed to get this to work, or know if it’s even supported?

In the Image component of the object with the Button script, modify the Color field so that the Alpha is 0. This will make the image transparent, but the area occupied by it will still read input.

You could also make a panel with transparent image and use TriggerEvents if you want to read events beyond just button click.

I’m not sure what the OP’s intended goal was, but for me the challenge was that I wanted my button to provide a more generous clickable “hot zone” around the visible sprites layered on it, and without adding to draw calls. First I found that the Color alpha technique above does work, but at the expense of a draw call, since the renderer still treats each invisible Image as an object to draw.

So I used the invisible texture approach also mentioned above (just a small blank texture 32*32 I created in Gimp that was entirely just an alpha channel) to use as my button’s Source Image. And by saving it in the same ARGB format as my other sprites, I was then able to pack it into the same atlas as my other UI objects using Sprite Packer, and so achieved my invisible hot zone and did not accrue an extra draw call.

As mentioned, it’s not the prettiest solution, but at least there doesn’t need to be draw call wastage if you pack the blank texture.

An empty text with a raycast target is a better workaround as it does not contribute to overdraw.