UnityEngine.EventSystems.PointerInputModule.DeselectIfSelectionChanged C# (CSharp) Method

DeselectIfSelectionChanged() protected method

Deselect the current selected GameObject if the currently pointed-at GameObject is different.

protected DeselectIfSelectionChanged ( GameObject currentOverGo, BaseEventData pointerEvent ) : void
currentOverGo GameObject The GameObject the pointer is currently over.
pointerEvent BaseEventData Current event data.
return void
        protected void DeselectIfSelectionChanged(GameObject currentOverGo, BaseEventData pointerEvent)
        {
            if (ExecuteEvents.GetEventHandler<ISelectHandler>(currentOverGo) != base.eventSystem.currentSelectedGameObject)
            {
                base.eventSystem.SetSelectedGameObject(null, pointerEvent);
            }
        }