Blueprint: Cast to any hit object, call event

Is it possible to create a generic event (let’s call it “Use”) that can be called on any arbitrary object that is hit by a line trace?

In other words, I have a line trace set up in my player controller. If it hits a door, I want the door to open. If it hits a lightswitch, I want that lightswitch to flip. If it hits an object without a “Use” event handler, I want it to do nothing.

I’d rather not have to spell out individual casts and events for each possible object, but as far as I can tell events require a specific blueprint reference. I haven’t been able to find a way to get a blueprint reference from an object reference generated by the line trace.

Thanks in advance!

Nevermind, I got it.

To anyone else that has this issue, the answer that I found is to use Blueprint Interfaces. Basically, it creates a generic function call that you can then have call any arbitrary node from your blueprints. Importantly, it accepts an object reference rather than a blueprint reference, so you can use return data from most world query nodes to access the returned object’s blueprint.