Download

Casting from one Blueprint to another doesnt seem to work.

Hello, first time I post here.

So im making a horror based game and im trying to set up a key for a door(see image) but whenever I try to cast it from the key_blueprint to the door_blueprint it always says cast failed. How come? What am I doing wrong?Unreal Engine Demo 2017.06.14 - 16.35.07.12.png

Any help would be extremely appreciated!

What type of object is MainDoor? It needs to be a parent of Regular_Door_Main_Door for the cast to work.

MainDoor is the same as Regular_Door_Main_Door. the note says it doesnt really need the MainDoor to work, but i have tried several other attempt but same result as that.

Is your main door variable populated, is it pointing to anything.

This is a good question. From what I can gather of the rest of OP’s comments, the note from the screenshot is saying the cast is unnecessary because “Main Door” is already guaranteed to be the class he’s casting to. The only reason the cast would therefore STILL fail would be that the “Main Door” variable isn’t actually set to anything, right?

MainDoor is a variable in this blueprint, so casting to the same type of MainDoor is not needed. You can just pull off MainDoor, check if valid then pull off main door and unset islocked.

The note is saying you don’t need the cast.

The reason it’s not working is because possibly the MainDoor variable is null or in other words not set to anything before you try to unset the islocked.