Access Array from GameState Blueprint

Hello - UE4 noob here.

I have a series of doors that are locked and I am trying to store the “keys” to the door as an integer array in a GameState blueprint. I have a reference to my Gamestate blueprint and pulled out the array but there is some problem - when I use the array contains node it returns false even though it is true. A test array built in the door blueprint works fine.

What am I doing wrong? Is there a better way/place for my integer array of door keys? When I watch the value it says NOT IN SCOPE. Thanks for your help.

First of all: Have you filled the GameState variable with the GameState reference or did you just create the variable and used it? Because pointer variable, like the one you created, are NULL or empty when you don’t fill them.

You will better just use “Get GameState” and cast it to your custom GameState Blueprint class.

So it won’t use the default values I set for the array?

It is using nothing. I was talking about the blue “TVGameState” variable. Did you fill it with the actual gamestate reference? Otherwise it is empty and you are trying to get an array from… Nothing. The blue variables are pointers. They have no value when you don’t fill them. They are just containers. You need to get a reference to the gamestate. And you can already do this in every blueprint by just calling “Get Gamestate”. You just need to cast the return value of that ge gamestate node to your own gamestate bp class that you created and setup in the gamemode.

Thanks for the help!