Last active
          April 18, 2025 20:25 
        
      - 
      
- 
        Save kurtdekker/043891a1d27b0e7df6f3f064da6d70ad to your computer and use it in GitHub Desktop. 
Revisions
- 
        kurtdekker revised this gist Apr 8, 2022 . 1 changed file with 5 additions and 10 deletions.There are no files selected for viewingThis file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,17 +1,18 @@ // From: https://answers.unity.com/questions/801928/46-ui-making-a-button-transparent.html?childToView=851816 // // @kurtdekker // // Touchable invisible non-drawing Graphic (usable with Buttons too): // // To make an invisible Button: // // 1. make a Button in the normal way // 2. delete the "Text" GameObject which comes below a Button as standard // 3. delete the "Image" which comes on a Button as standard // 4. drop this script on the Button, which lets the Button get touched using UnityEngine; using UnityEngine.UI; #if UNITY_EDITOR using UnityEditor; @@ -31,12 +32,6 @@ protected override void OnPopulateMesh(VertexHelper vh) vh.Clear(); } #if UNITY_EDITOR [CustomEditor(typeof(InvisibleGraphic))] public class InvisibleGraphicEditor : Editor 
- 
        kurtdekker created this gist Apr 11, 2021 .There are no files selected for viewingThis file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,50 @@ // From: https://answers.unity.com/questions/801928/46-ui-making-a-button-transparent.html?childToView=851816 // // Invisibly-touchable Graphic component for Unity3D // @kurtdekker // // To use: // 1. make a Button in the normal way // 2. delete the "Text" GameObject which comes below a Button as standard // 3. delete the "Image" which comes on a Button as standard // 4. drop this script, Touchable.cs, on to the button using UnityEngine; using UnityEngine.UI; using System.Collections.Generic; #if UNITY_EDITOR using UnityEditor; #endif public class InvisibleGraphic : Graphic { public override bool Raycast(Vector2 sp, Camera eventCamera) { //return base.Raycast(sp, eventCamera); return true; } protected override void OnPopulateMesh(VertexHelper vh) { // We don't want to draw anything vh.Clear(); } // alternate for older versions of Unity (like really old) // protected override void OnFillVBO(List<UIVertex> vbo) // { // base.OnFillVBO(vbo); // } #if UNITY_EDITOR [CustomEditor(typeof(InvisibleGraphic))] public class InvisibleGraphicEditor : Editor { public override void OnInspectorGUI() { // nothing } } #endif }