Castto failing

Running in to a problem with casting. Im making an object to trigger a flipbook when destroyed. For testing im just trying to trigger the flip book on overlap. In the object, casting to “DoorBP” (the BP contain the ‘DoorLift’ event) fails. Setting to fail will reach DoorLift but still not activate it. Any ideas?

Everything correct here. Check your Collision Setup on both sides and make sure your Door Lift Event actually works. Add a Print String there to see if it gets called at all.

Dont link both. If cast Fails the output will be empty (None) and will result in errors. Your Overlap can be triggered by other actors too so looking at it is not a guarantee that it was the door who triggered it. And since your Cast fails I have to assume your Door never triggers the Event → Collision Setup wrong, check both Blueprints again please.

The DoorLift event works as intended when i trigger it independently. Double checked my collisions, everything looks good. Watching it simulate it will fire from ‘On Component Begin Overlap’ to ‘Cast to DoorBP’ then dies after that. Itll trigger a cast failed however and display the following error message when both are linked to ‘DoorLift’

Blueprint Runtime Error: Accessed None trying to read property K2Node_DynamicCast_AsDoor_BP from function: ‘ExecuteUbergraph_DoorTriggerBP’ from node: Door Lift in graph: EventGraph in object: DoorTriggerBP with description: Accessed None trying to read property K2Node_DynamicCast_AsDoor_BP

I’m sure i am overlooking something simple. I made a video that hopefully gives more detail. I cant seem to find any error with my collisions settings.

Ahh ok gotcha. No that wont work. Your character walks into the trigger. Your Character is not a door so cast will fail naturally. For this to work your door has to walk into the trigger or the trigger into the door (I assumed the overlap was on your character). Basicly you never get a door refference the way you got it right now.

But fear not you can add a DoorBP variable, make it editable, select it in the Scene and set the refference to the door you want to trigger. On your Begin overlap get that variable and hook it into Door Lift Event. No cast needed unless you want it to limit to the player only as example.

Thats it.

Ok I get it. Still trying to figure where to place what provided in your answer. I think I’m on the right track tho :D. Any chance you have a visual reference would be great thought. I’m sort of learning as I go :smiley:

thanks so much, had it all correct but didnt set target blueprint. Youre a life saver.