Download

4.7.3 Communication between blueprints

Hello, so the “target blueprint” type of a variable is now gone and how can it pass variables through different blueprints? What i want to do is when “W” pressed using player controller blueprint, change boolean “w_pressed” in the blueprint “CRF” OR the “CRF” blueprint will read boolean "w_pressed inside of the player controller blueprint. It doesn’t matter for me which way but how to do that now? I have tried to use “get player controller” but i don’t know, it doesn’t work for me i guess?

Are u casting to the player controller type that holds the w_pressed? Is the w_pressed a public editable variable? You could store public variables in your player character type as another idea, or get a reference to the instance of the blueprint youre trying to send w_pressed to and modify w_pressed the other way around. Is it a multiplayer game? Getplayercontroller probably isnt the best idea, but instead to send the variable change from the player controller outward. Like if the button w_pressed occurs then you’ll want the owning controller to perform an action rather than check all available controllers for whether a w_pressed event occurred.

I am casting from player controller to “CRF” blueprint when the W button is pressed. Yes, w_pressed is public inside “CRF” blueprint. It is not a multiplayer game. Casting from player controller to “CRF” is always failed as well. Probably i just don’t know how to do that?

CRF is the name for your custom player controller class? Or is it the name of a different blueprint type?

It is the name of a different blueprint.

Well thats alright its just a slight misunderstanding of the way casting works. In this scenario, player controller and crf are two completely different types of data. Hopefully I can make a little sense of it, casting basically changes a type of data into another that is related to it, derives from it, that is upper or lower in the hierarchy of that class. So if you were to cast the player controller you can only cast it into a different class that is created off a player controller, or a class that player controller is created from. You will need to cast your player controller into the player controller class type that holds the variable w_pressed. Then, unless crf is a function library or something else i cant think of you’ll need to spawn a crf game object. After it is spawned you can modify its internal functions and no casting is necessary on that variable. So it goes getplayercontroller-> cast to customplayercontroller-> get W_ispressed-> then do what you want with w_pressed.