Object reference to object reference with class

Hello,
my Question is simple, is there a way to get the object class (Object pin) to convert to an object reference with class (Return Value pin)?
I want to get a similar behavior like the Filter by Class function, but only with single objects not arrays.

Thanks for the help!

… what are the error message(s)?

Those were from testing around, nothing relevant for the question.

i’m not sure i understand the question. if you’re wanting to return a class, then set the return value to be a class ?

Yes, this would be a solution if I only want to filter out one specific class, but I want to filter different classes. Would there be a way to always set the class I want to filter?

I’m wondering if the root of this problem, running different code depending on difference between classes, is something that could be solved using interfaces. Then you don’t care about the class.

1 Like

Do you mean “IsA” or “ClassIsChildOf”?

What would that look like?

Instead of something like

you can have

image

To be clear, though, if they all have the same way of implementing damage ( in this example ), then they should use class inheritance, and you only need to check for the parent class.

1 Like

I am so confused by what you’re looking for, I drew up this

does that look like what you’re looking for?

and like ClockworkOcean, I do wonder what you’re wanting this utility for, there’s probably a better way to do whatever this is going to be used for

1 Like

Hey, sorry for my late reply.
So I’m looking for a similar behavior like the “Filter by Class” Function from the Datasmith plugin. Here is an Overview:
Object Reference
On one hand, you get an Array of Object References and a class to filter, and then it returns the filtered Array with the coresponding object reference type.
I’m basically looking for a function that replicates this behavior with single objects, not Array’s.
I hope this helps you understanding what I want.

But again, I’m not sure if this is possible with simple Blueprints…

you can just put the single object into an make array node, and from the output get a copy.

Yeah I know.
This macro, or whatever it will be, would just be way more convenient to use.
I’m mostly doing this to learn about Unreal Engine itself.

in that case I’d probably take @ClockworkOcean 's method as the “most correct.”

If you make a class reference in one blueprint, that creates hard reference to the class which can have a snowball effect of not-needed classes all getting loaded at the same time. If you start to notice blueprints taking longer to open in the editor, this is tell-tale indicator.

unreal is offering tons of ways to filter sans class reference - I imagine for this reason. Interfaces are a great way, but just one of many ways.

2 Likes

Okay, so I end up doing it in a completly different way that doesn’t need those weird tricks.

Thanks to all of you!