Accessing variables from one blueprint to another

Hi!

I have recently started to learn the blueprint system. So, sorry if this question sounds a bit obvious, but I have been trying to figure this out for quite some time.

I am not trying to do anything specifics, but to make it work.

I have created a variable Apples (Int) with a default value of 3 in the MyGame blueprint and I made it public.

I am trying to access it from the MyCharacter blueprint. In the end, I get the failed message, but I’d like the number 3 to appear on screen.

I am really not sure what I am doing wrong. Thank you.

Casting is a funny thing, there’s so many things that can go wrong. What I would suggest you do is in the “MyGame” blueprint, casting to the MyCharacter blueprint via “Get Player Character > Cast to MyCharacter” (Using the get player character node to create the “Cast to My Character” and then setting the MyCharacter’s Apples to the same amount as the apples in the “MyGame” blueprint.

Thank you for your answer. It’s really appreciated. :slight_smile: