Invisible Transparent Button in Unity3D

Today i was working on a project where i required to add the invisible button. I tried different methods like making button transparent, adding the image in the button. But then i came to know about this solution. I think that this is probably the best solution.

Steps to add invisible button in Unity3D

1. Add the Button. (UI -> Button)
2. Edit the height and width of the button according to your fit.
3. Delete the Image(Script) and the text from the button.
4. Create new C# script (Touchable.cs) and add the following code into it:


// Touchable.cs
using UnityEngine;
using UnityEngine.UI;
#if UNITY_EDITOR
using UnityEditor;
[CustomEditor(typeof(Touchable))]
public class Touchable_Editor : Editor
{ public override void OnInspectorGUI(){} }
#endif
public class Touchable:Text
{ protected override void Awake() { base.Awake();} }

5. Add Touchable.cs script to the button.

Done!

Now you have the invisible button.

Source: UnityForum

Finally Graduated, I am an Engineer now

Hello all,

I have completed the Bachelor of Engineering in Software Engineering from Gandaki College of Engineering and Science (GCES), Lamachaur, Pokhara.

Recently on February 25th 2017, I had the convocation ceremony. The summary of this event can be found on my next blog. “Convocation Ceremony – Pokhara University“.

Graduation Photo

I would like to thank everyone for helping me through out this journey. Especially my Father, Mother and my brother.

This will inspire me to do more in my life for my country and for the world.

Thank You All!