[Paper2D] Removing a sprite using Blueprints?

Hello,

I’m currently working on a 2D Platformer in my spare time. Though I’ve run into a problem.
What I’m trying to achieve is; Whenever I turn off the Blue Switch, the Blue Lasers will disappear.

What I have right now is this:

This is the Blueprint for the Switch. It does change into a different sprite.

Which is referenced and cast to in the Blueprint for the Laser:

This is the Blueprint for the Laser. It doesn’t remove the sprite so the player can continue.
I’ve tried replacing the “Deactivate” node with multiple other ones, such as changing the sprite and leaving the selection empty, turning it invisible and removing the actor.

If anyone could help me out on this one, that’d be very much appreciated!

Hey ,

Once I changed the name of the variable to “TurnedOff1” in the Switch blueprint, the variable in the Laser blueprint changed as well. So I’m pretty sure they’re referencing each other.

I also changed the “Deactivate” node to “Toggle Active”, but that doesn’t help either, sadly.

Hey ,
I’ve connected the nodes like this: Screenshot by Lightshot
And it does in fact work: Screenshot by Lightshot

ClelstialSatyr,

Here is my theory:

  1. The blue prints are referencing two differnet ‘TurnedOff’ variables. Hence the second ‘TurnedOff’ variable is never set to true.
  2. The deactivate is not working as you said, you can try flipflop, toggle Active as alternatives.

Hope this helps

Celestial,
Can you setup a print statement at CastFailed in the Cast To BlueSwitch Industrial level01, a print statement in both True & False pins in the Branch Condition Node and let me know if the print statements are being printed as expected ?

Thanks

Can you try a seperate string for cast failed and cast not failed. Also can you do the same for the true and false condition ?

Apparently, it’s the cast that’s failing: http://prntscr.com/g2wazx
Might be because of the node that’s connected to the object?

Awesome … so we figured out that the failed cast is the issue … were you able to troubleshoot further ?

I was indeed, thank you so much for your help!