Why can't I hook up this return value? Find Nearest Actor node.

Hoping someone can explain this to me. Why doesn’t this work when the return value is an actor being returned from an array versus an actor that’s being selected individually? I’m pretty new to scripting but this seems like it should work.

Both “Get Actor Of Class” and “Find Nearest Actor” nodes return values are an actor object reference. But the top one does the automatic conversion when hooking it up to the collision node, and the other one doesn’t.

Thanks!

It’s expecting a Component of the Actor, not the Actor itself

Yep I understand that. The node above it automatically adds the Target node conversion in between. But the bottom one doesn’t. It doesn’t look like I can access a component of that actor (like I can with the node above) and I’m wondering why?

My guess would be because GetActorOfClass is returning a specific class that has a single primitive component that it knows is there, but Find Nearest Actor returns an Actor reference, and Actor has no default primitive components.

I’m not positive on it, but I bet if you cast the out from Find Nearest Actor up to the Invisible Wall class, you’ll probably be able to get a component out of it. Worst case, you can go to any of the GetComponent type functions in Actor and find whatever you’re looking for

1 Like