Hello, I’ve been reading the documentation on blueprint communication and apparently in the latest version (4.7), this feature seems to no longer be present, and neither is the Target Blueprint variable.
So how do I cast to a blueprint now? Or how do I get access to a blueprint’s variables and components, from another blueprint? I couldn’t find any information on this matter.
Well classes are recipes how to create objects, when in game you’re looking at objects.
JF_GameModeBP is a blueprint having GameMode class as parent.
In this case is an object type, it’s already cooked and running in the game:).
The point is that only one GameMode exists so you can always get it from any blueprint using GetGameMode function as seen on screenshot.
This makes it easy to access all GameMode content from other blueprints.
To cast between other blueprints all you need to have is a reference, for example once the game starts there could be many characters or some objects in game, if you’d try to cast it to lets say HUD blueprint,
how would you figure out which one of them you want?
So this is the only problem, you need a reference.
Lets say above picture is casting a GameMode blueprint to Character blueprint,
that means at begin play all the characters will first get reference to the GameMode.
Then you could set it up so that when a character is clicked you would save reference to self into a GameMode blueprint,
So now other blueprints can get this reference from GameMode blueprint in same way and GameMode will remember it until is changed again or until end of the game session.
Of course you first need to create a ClickedCharacter (blueprint) object type variable in GameMode.