How to use "Cast to " in global variable ?

Hello There ! :slight_smile:

Take me a some tips for global variable.

I have 2 blueprints, in first my actor got a key, in second, i check, pick uped my actor a key or no. But isn’t worked :frowning:

Pls help beginer, maybe i do my blueprints no right

When creating components like “Box” you should make sure to name them something more descriptive.

I will assume the top image is the player, and the bottom image is the door.

The event in the player should look more like this:


The only major difference is that we make sure what we collided with is a key. We also just destroy it directly rather than finding it through tags.




As for the event in the door, it should be more along these lines:

There are quite a few differences in this one. First, we check that what we overlapped was the player rather than key. Second, we check to see if the player actually has the key. And finally, we set the door to is open.


Replacing that Set DoorIsOpen node to a destroy node for self like so would be a quick way to check if it worked.
image





Also keep in mind that you might not have the collision set right, so make sure the event fires in the first place by placing a print string node.

Thank you! I’ll try
this solution

1 Like

Hey there @FaulerDamon. Welcome to the Unreal Engine Forums! :smiley:

This topic has been moved from Community Showcase to Programming & Scripting: Blueprint.

When posting, please review the categories to ensure your topic is posted in the most relevant space.

Hopefully, this category change will help in finding an answer. In the meantime, good luck and happy developing! :slight_smile:

1 Like