Why does this cast always fail?

I am a newbie at UE5, I have followed tutorials on YouTube but I am still stuck. I am having trouble casting in a specific blueprint for some reason. I am trying to cast to my Tutorial door and change a variable that will allow the player to open it. As soon as the player picks up the key, using the interact interface, it should cast to the door blueprint and change the variable to true, so the door can be opened. And for some reason I cant find out, It always fails. If you need more information about the situation let me know. Any help would be appreciated.

Hey @Wipeout3003! Welcome to the forums!

So what I’m seeing is the “Tutorial Door” variable that you’re casting, it isn’t set. Where are you setting that reference?

A cast is not a communicator, it’s something like a mold. You can make something with a more wide option (say, an “Object”) act like something that is more specific. If the item doesn’t fit in the mold (hence, “cast”) it will return a failure. I assume the object you want to pass in IS of the class you’re casting to- so I’m thinking you’re not getting a reference to the object you want to cast to. :slight_smile:

What is the interaction you’re going for like? The thing is you’ll need to have a way to say “This specific door in the level.” I would try going back through your tutorial and looking for anything that might pertain to that!

Thanks for the advice! I was able to fix it by following the tutorial again. I did not correctly set the variable as you said. I still think casting is confusing but you really cleared some things up for me.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.