Download

Error when getting variable from other Blueprint

Hello.

I’m sure I’m missing something simple but I’m receiving an error when getting a variable form another Blueprint.

More specifically.
In the Level blueprint I’ve created an integer array variable named “Shuffled”.
I also have a Pawn Class Blueprint in which I want to get the “Shuffled” variable. When I used get Shuffled and complied an error occurred (as seen in the image below).
Am I doing something wrong or the way to get that variable is completely different?
a614a9fe09cafb8bbe84eee49490f4b807623fad.jpeg

Hey there,

first of all, don’t place Variable inside the LevelBlueprint that you want to use later in other BP.
The LevelBlueprint doesn’t want to be accessed easily like other BPs.

The error just tells you, that the “Target” should be something else than “self”. “Self” is the BP you are working in at the moment.

So if this is the CharacterBP, then i tries to get “Shuffled” from the CharacterBP. But you don’t have it there.

If you want to have a global “Shuffled” array, then try to use another class. For example the “GameState” is a class that you can access by use “GetGameState”
in every Blueprint. It is designed to hold information about the current State of the Game. You can create your own BP that derives from “GameState” and
also set this custom GameStateBP in your Project Settings under Maps & Nodes. Same way as you set the Character, Controller, HUD, etc.

Thank you for the fast reply, I’ll try what you said.