integer variable result in another blueprint

Hi all,

I’m stuck against that **** simple problem:

How do I get an integer variable result into another blueprint?

Thanks a lot for your help

Conrad

Make the variable public by clicking the little symbols next to the variable name . Then you cast to the blueprint that contains the variable you would like to get using the cast to node . The target must match the type of blueprint you are casting to.

Watch and follow this:

Hi,

Thanks for your help but I can’t understand neither the explication nor the video.

Is it possible to add a simple exemple of a basic variable casted and used in another blueprint?

Thanks very much!

im at work at the moment so i cant post any code but if no one has answered by the time i get home i will.post an example

There are many ways to pass variables from one blueprint to another, without knowing more about how you would connect them with each other it’s hard to give you a right answer, but if you just wish to test blueprint communication then a really easy way to do this is to create a blueprint and name it something, in my example below I named this new blueprint BlueprintA, I then went inside of BlueprintA and made an integer variable called Age. Now if you place this blueprint into the world, by simply dragging it from the content browser into the level viewport it will be a part of the world and you can reference it without much trouble.

I then went into a different blueprint, in this case my playercontroller and created the things you see below.
If there is only one blueprint of this type it becomes really easy, you can use a “get all actors of class” node and take the first item that it finds then from that you can get the integer variable and do with it what you want. Let me know if this is not what you meant.

The easiest way is to use your player controller blueprint to store common variables. Then use get player controller in each blueprint that needs the var. if you make your own player controller BP you’ll need to cast to it after the get player controller node. Then you can get or set the var. it’s quite good to convert your cast to pure in this case.

Wonderful. This help me a lot.

Thanks to you all for your help!

Sorry but this is a really bad way of doing it and a waste of resources. This method should only be used if there are no other better alternatives.which there are. You can use casting, public variables or even create a reference to the blueprint and get the variable that way .

My big thanks. It helped!