How to get variables from level blueprint?

Hi there :slight_smile:

I’m going to get some Variables and Structures From Level blueprint.

But I can’t access by direct communication(Referencing)

and I dont know how to cating.(I already saw casting part of the unreal wiki, but I cant understand about casting /// bcause I’m a Desginer.)

So Could you tell me Two ways of accessing (Referencing and Casting) variables from Level blueprint. for Novice :slight_smile:

Thank you :slight_smile:

Hey :slight_smile:

To my knowledge its not possible to cast to the level bp. An easy solution though is to store variables in the Character bp, since this is always accessible by using cast to character blueprint and using the ‘get player character’ node as the object reference (wildcard).

casting is basically a way of communicating between blueprints. You said you read the wiki, i would suggest to also have a look at the documentation. The example Epic provides should give a relative basic understanding of what casting does.

here’s a link:
https://docs.unrealengine.com/latest/INT/Engine/Blueprints/UserGuide/CastNodes/

Good luck :slight_smile:

1 Like

Check out Game mode, Game Instance and Game States. Each can be casted to from just about any other blueprint.

I use game state to save some variables I want to have access to for other actors and such. Or for my saved game variables I save them using the game state.

To create a game state, right click in the content browser in the editor, like you would if you want to create an actor blueprint. Click blueprint class, and in the search box type game state. Change the name of the game state blueprint.

You can now use the game state blueprint to access variables for other actors. Like say for example a score. Keep track of the score in the game state. Should you want to access the scores variables with a HUD lets say, you can cast to the game state blueprint by right clicking in the HUDs event graph and look for “get game state”. Then drag off of that to cast to the game state you created. Then drag off of that to get any variables out of the game state.

If you choose to go with a game mode, you can get game mode, then cast to game mode that you create.
Do the same with game instance, get game instance, cast to game instance you created.

Anyways, casting can be a bit tricky. I get lost a lot when I’m trying to cast from an actor of some sort to some other actor.

Good Luck

~

4 Likes

Thank you so much :slight_smile:

gamestates are for network afaik