Last active
May 11, 2020 20:18
-
-
Save unitycoder/6cfbba6766eb74e3d3f8 to your computer and use it in GitHub Desktop.
Revisions
-
unitycoder revised this gist
May 26, 2019 . 1 changed file with 27 additions and 0 deletions.There are no files selected for viewing
This 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,27 @@ // ignore mouse clicks for UI using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.EventSystems; public class FixMouseClicksForUI : MonoBehaviour { GameObject lastselect; void Start() { lastselect = new GameObject(); } void Update() { if (EventSystem.current.currentSelectedGameObject == null) { EventSystem.current.SetSelectedGameObject(lastselect); } else { lastselect = EventSystem.current.currentSelectedGameObject; } } } -
unitycoder created this gist
May 3, 2015 .There are no files selected for viewing
This 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,11 @@ using UnityEngine; // http://answers.unity3d.com/questions/816861/46-ui-image-is-capturing-clicks-how-to-prevent.html public class UIIgnoreRaycast : MonoBehaviour, ICanvasRaycastFilter { public bool IsRaycastLocationValid(Vector2 screenPoint, Camera eventCamera) { return false; } }