Need help with Event Trigger

I have a button with an Event Trigger - PointerClick. Here’s what I’m trying to do:

        print(EventSystem.current.currentSelectedGameObject.name);

However, it’s giving me a “NullReferenceException: Object reference not set to an instance of an object” error.

I’m simply trying to determine the name of the object which was clicked. I don’t want to have to create 60+ individual functions for each button - I should be able to get the object name, and then process based on that.

Help!!

Never mind. I discovered that you have to have “Navigation” set to something other than “None” in order to trigger this.

For the future, note that the UI forums are here.