InteractWithUI() method

So when I did this challenge I went really basic and just did

private bool InteractWithUI()
{
SetCursor(CursorType.UI);
return EventSystem.current.IsPointerOverGameObject();
}

Which seems to work perfectly and i’ve not noticed any bugs. Is this wasting resources or something compared to Sams method of using and if statement to return true and false?

Once we get into the Inventory course, we’ll need to return to an if condition based method, because of interactions with dragging, but there’s another concern… you’re calling SetCursor() in the method regardless of the value of IsPointerOverGameObject. You’re going to wind up sending multiple calls to the graphics card for the cursor per frame which is inefficient.

Thought as much. Thank you for your help.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms