Download

Difficulty with casting

Hello everyone! I am having some trouble with something which I, at the moment, believe to be caused by my blueprint casting. Here is what I am trying to do: I have a blueprint that has a variable. That variable is activated when the character is interacting with said blueprint in game. So far so good, checked that the variable is actually being activated when the character interacts with the blueprint in game. After that interaction I want the variable activated to make another blueprint move in game. However I am unable to achieve that. The moving part of the second blueprint is correct as when it doesn’t rely on the branch checking for the activated variable, works just fine (moving where it is meant to once removing everything from CastTo up and including the branch).
I previously added a breakpoint on the CastTo and it does go off when simulating, however the breakpoint in the branch never does. Any help is greatly appreciated, and let me know if you need more info.

That means the cast is failing. In other words, the owner ( of whatever this code is from ), is not a DuplicateSecretPainting.

Lemme get this straight: Player interacts with BPa, which has a variable, which then makes a call on BPb?

What you have there would only work if the owner was the right type AND variable MoveCube was already set at begin play.

From what you’re saying, all you need, is when the player interacts with BPa it uses a reference to BPb and call the ‘move’ custom event.

Also ( then I’ll shut up ), if you have spawned this BP ( in the pic ), did you actually set the owner?

Hey!
Thanks a lot for taking the time to write this answer. I was able to fix the problem thanks to your suggestions. Here are the modified blueprints, now working as intended.

Firstly, as my casting wasn’t working I introduced the following in the BPa (Block Block in actor class is BPb, don’t judge my naming convention) :


Bellow is the casting in BPa, now working properly and calling the custom event from BPb:

And finally the BPb event that is called from BPa.

Once again, thank you.

Hey, no worries. You don’t need to cast that BlockBlock ref ( see the big blue NOTE underneath :wink: )