How do you get a reference to an object onTouch?

Hi everyone, I’m working on a mobile game requiring object inspections. I erroneously began the work in the Level Blueprint. I’ve found through different tutorials that I SHOULD be working in the Character Blueprint (because I will end up re-assigning functionality to the virtual joysticks to rotate the object instead of moving the character), which leads into my problem. Obviously, I can’t create a reference to every object I will want to inspect in the entire game in the Character Blueprint.

So my question is this: How do I make a “generic reference” to an object that I touch, which I will then check to see if it has an “inspectable” tag? Hopefully I’m clear enough with the question…

And FYI, I’m a noob haha, so I very well may be overlooking something fundamentally simple/important.
Thank you in advance!!

Many people make use of blueprint interfaces for this kind of object interaction.
A blueprint interface is simply a set of functions (or just one) that you can add onto an existing blueprint.

That way you can grab an actor reference and use the ImplementsInterface node to find out if it has that interface and if it does then call the function on that actor. Then in the actor you use the interface function to handle the interaction.
So if you have an Apple class, a Banana class and a Cherry class and they all implement an interface you called Interactable, then you can call the function InteractMe on any of those three.

In each one you can handle the interaction differently.

A perhaps better option is to create a parent class of blueprint which contains that InteractMe function and then make Apple, Banana, and Cherry child classes of it. Then they will all have that function and you only have to create the logic for it once in tbe parent class and then just only use the child classes and never put the parent class in your level because they can do it the same way the parent does because they inherited the function logic.

Anyway the InteractMe function could be called anytime the character is both linetrace hitting the object and pressing a button (the character class handles that part and calls the InteractMe function), and then whatever the object does in its InteractMe function will happen.

Thank you so much for your reply! This is great advice that I’m absolutely going to implement! I’d like to clarify my question, though. I feel I may have been unclear with my actual question. If you see the attached photo, the OnInputTouchBegin has a node for TouchedActor. With the generic EventBeginInputTouch, however, there is not. So is there a way to say “I touched an actor, give me that touched actor”? Thank you again!

Side note: I know that I could use line tracing and get the hit actor, but I’d like to not require the player to be looking directly at the object they’re trying to inspect, which is why I’m looking for a “simple” “touched actor.” But hey, sometimes you gotta bite the bullet haha

Oh okay. Maybe it would work to get the Touch coordinates and do a (de)project into the world from there and see if it hits the actor. That deproject function I THINK can return whatever actor it hits. It’s like a line trace but not from the actor, it’s from the screen itself into the world.

Found a function that perfectly answered my question! Figured I’d leave it here for anyone in the future with the same issue. It’s called “Get Hit Result Under Finger By Channel.” You then call “Break Hit Result”, drag off of the Hit Actor node, and call “Actor Has Tag” to check for the tag. Thank you, everyone, for the help!