- Home /
Question by
viesc123 · Jul 22, 2021 at 08:45 AM ·
uiguieventsystemselection
How do disable uGUI/EventSystem selection feature?
If my players only use pointer based input devices (mouse or touch) I don't need the Selectables feature of Unity GUI. Is there a way to disable it? I currently just have an Update method where, if there is a selected object, I will remove it. It does the job, but is not very nice.
void Update()
{
if (EventSystem.current?.currentSelectedGameObject != null)
EventSystem.current.SetSelectedGameObject(null);
}
Comment
Your answer
Follow this Question
Related Questions
How do you highlight/select a button upon mouse enter and keep it moused over upon mouse exit? -2 Answers
One EventSystem for 'physical' objects and one for UI ? 0 Answers
Limit the selection box to not go inside the UI 0 Answers
UI: Mouse events not working 1 Answer
What's the difference between Selectable.Select() and EventSystem.current.SetSelectedGameObject()? 0 Answers