Variable not in Scope.....

See the attached image. What I’ve got going on here is a “Football” Blueprint trying to communicate with the My Character Blueprint. All I want to do is have my “Player has Ball” variable (from the “My Character” blueprint) accessible and changeable inside of the “Football” blueprint. However, I keep getting “variable is not in scope” messages and I don’t understand why. What can I do to fix this?

It’s not in scope to the debugger or you get this issue when trying to use it?

Hello,
drag a “cast to” your character from your “character” variable and you’ll can access your “Player has ball” variable.

You shouldn’t have to do that because it’s a variable of your character class, so you shouldn’t need to cast.

This is actually an issue with Blueprints, any variables you access inside a function always appear as ‘Not In Scope’. There are two ways around it, you can make a collapsed graph of the nodes, or you can just have it in your main blueprint until you know it works, then collapse it to a function. Strange how this hasn’t been looked into yet actually, though I’m not sure if it’s a bug or a limitation.

1 Like

It doesn’t seem to matter if I use the above method (in the screenshot I provided) OR if I do a “cast to my character.” In both cases, I get this “variable not in scope” message and stuff doesn’t execute as desired because of that issue.

In your other thread pointed the fact that maybe your character variable maybe the trouble. If you made a generic player instead of your specific one, or if for some reason you did changes and they were not updated and that you need to delete / create / add again to have it working, it maybe the issue of your two troubles.

Hi VagrantProfile,

If you feel this may be a bug in the editor, please make an answerhub post at http://answers.unrealengine.com in the bug reports section. In this, please make sure to include any reproduction steps you may have so that we can reproduce it on our end.

Here’s a question: As you can see from my screenshot above, my “MyCharacter” variable is associated with my “MyCharacter” blueprint (the one that comes by default with the 3rd Person template). HOWEVER, this variable itself is referenced DIRECTLY by a copy of the “MyCharacter” Blueprint I placed in my level (see pic below)> I did this because I do no know how to reference the character I SPAWN IN AS. Could this be the problem?

fb520ee8a5a6093536c22301c712f953641bf0cf.jpeg