Hey, i’m making a prototype of a space-y shooter game and i’m planning on it having more than one level. However, i want to make each level have a different goal values on the UI, so i tried using each of their level blueprints so that when they’re loaded in, it changes the values on the ui. The issue is, despite using cast nodes (as shown in the embed) and getting all the needed references right, i can’t do anything with them (set text nodes give out a null pointer error). Doing what i show in the embed usually works fine for me when i’m working with other classes, but not the level blueprints. How can i change the values in the ui for each level then?
https://imgur.com/a/DORfuB5
Game Instance:
- create new bp that inherits from game instance
- game instance is weird bp, it starts first, so no other actors/blueprints are loaded yet when you use Begin Play in game instance
- however all other actors can get game instance, then cast then store/read variables from it
- and it survives level load
More tips:
- NEVER use level blueprint as it is quite limited
- look into Data Assets, you can create DA that holds “Soft reference” to your level and all settings meant for that level. Then in game instance you get data asset, read values, load proper level.
- data assets are great for this, as they are separate objects on HDD, you can open them and edit there, just like structs. So you add new level, create Data Asset for it, then Asset manager gets all data assets holding level info. No need to edit any bluepritnts when you add level.