Download

How do I connect an already existing object reference into the Cast to Object Node

Basically, what do I connect into the Object Pin?
I’ve watched about every tutorial I could find about the Cast To node, 95 % of them just show it with the game player, but that’s not my case.

In my case - as you can see in the picture - I’ve got a reference of an Animation Blueprint (leftEyeBlueprint) that I want to cast to. I thought I could just make a variable with leftEyeBlueprint type, and specify that reference in there under Default Value. But it doesn’t show up in the list. So then I thought I could just drag/drop the leftEyeBlueprint from the Outliner onto the Default Value box, but it doesn’t take it. I tried it with a SkeletalMeshActor variable, same result. In another video someone showed he was just selecting the reference, and then it showed in the right click menu. But not for me…

Any ideas what I’m doing wrong? How can I connect an already existing reference of an Animation Blueprint into the object pin?

Casting is pretty much just asking: “Is this thing <Object> that thing <CastToType>?” So above what you have to do is make the “leftEyeBlueprint” a pawn, and set the leftEyeBlueprint as a skeletal mesh variable inside the pawn.

Here’s how you add a skeletal mesh to a pawn:

9574ad162cf032d66b4be57c29f2a88cdece602d.png

Also above the “Left Eye” variable there isn’t a reference yet, it’s a variable of that type, but it doesn’t store any data / reference anything. (One way to think about it would be like saying that it is a phone number, but not writing down the phone number. Or, Phone Number = -*)

In your case it looks like what you want to do is something like this:

77faf2fc757a834beec31e8abc9b3458e1b1aa87.png
https://forums.unrealengine.com/core/image/gif;base64

So as the animation blueprint is updating, you get the pawn using this animation, and then you want to do something with that owning pawn, so long as it is of the type “leftEyeBlueprint”

Hopefully that helps :slight_smile:

Hi Tyler,

Thanks for responding so fast!

I tried this, but it still didn’t work - not sure if I’m doing something wrong or if I just have a different case, because I want to cast between different types of animation blueprints.

So I created a leftEyeblueprintPawn, that has the Animation Blueprint where I’m doing the casting. If I add a Try Get Pawn Owner to that blueprint, it would give me the parent of it, which is facePawn. Right? But not the animation blueprint that is assigned to that facePawn (faceBlueprint). Right?

What am I doing wrong here, I spent days on this now, I every time it simply just goes to “cast failed”

So I’ve got a pawn, that has a skeletal mesh as “faceBlueprint”:

And that then has another SkeletalMesh as “EyeBlueprint”. And as you can see in this picture below, is trying to get information from the top (“faceBlueprint”). But it constantly goes to “cast failed”