Passing variables between blueprints

Please can someone help me with something, i have huge problems trying to pass variables between blueprints. I seems to spend days trying to get this working and i always end up in the same situation.

All i want todo is to set up a global Variables that every blue print i create can access. Ive tried Casting, Blueprint interfaces and a number of things, but never seem to be able to get any of them to work properly.

Could someone give a a simple screen shot of how i can set up a Boolean variable in MyCharacter blueprint, which can be read by any other blueprint.

Ive tried all the tutorials on the ue site, and never seem to be able to get it to work.

Basically what i have is a boolean in MyCharacter, i have a pickup blueprint, and what i want to do is check if the boolean value in the Mycharacter blueprint is true, if so then destroy actor, if false do nothing.

Please please help me

First of all you want to make sure your variable is public, you do that by clicking the little eyeball/eyelash looking icon next to the variable. ( It being marked as public means other blueprints can work with it/change it.

Moving is a bool in my blueprint called Fish, let’s say it’s comparable to your character blueprint. Your pickup thing which kills your character will probably have some kind of event like this (

There are two parts to this: One is making sure the variable is public (so you can see it when you drag off of the cast node for example) and the other part is making sure you have a reference to the correct actor. So if you have a volume which overlaps, you can use the “other actor” field to figure out what you’re dealing with. You have to cast that actor to the class of your character (maybe it’s called MyCharacter in your case) because that’s the only way the engine can know what variables it does/doesn’t have access to.

Let me know if you need any more clarification.

Yep thats done it, thank you so much that been driving me nuts fr weeks. I didn’t realize that you could get variables from casting, i always assumed that casting so only used to send info, and not retrieving :slight_smile:

Sure, make sure you mark the question as being answered (commenting on it un-answers it, in case that already happened). Good luck with your endeavors!

OMG, I’ve been looking for the answer for 3 days! This one is the best answer. Thank you

the jpg is now missing

1 Like