Download

How do I get a value out of a level blueprint.

Hi

I can get a Value from another blueprint fine “Get all actors of class”, but how do I get a value from the Level Blueprint?

Narg

You can make a variable in the blueprint you’d like to give the value to. Then do a cast from the level blueprint and set that variable.

I ran into the same issue not too long ago. I started out putting a bulk of my code in the level BP but that was a big mistake. Especially when I realized that I would be needing a lot of the same code for all 50+ levels. Based on my research, it seems that it is not the best practice to use the level BP to store values needed by other BPs. I have moved all of mine to either a stand-alone BP or the GameState BP. I just use a cast from the level BP to get/set these variables as Redsett mentioned. I highly recommend doing the same.

If you haven’t used a Cast before, it can be a little intimidating at first but there’s some great documentation and videos to help explain it. I would suggest starting with the official UE4 docs first. That did a great job of clearing up many of the questions I had on how to use them. Once you have added the Cast, you will be able to see all the public variables of that BP in the context list from the blue pin of your Cast. I would also recommend adding a Print String to the Cast Failed so you can be sure you set it up correctly.