There are many levels in my project, data missed when level changed. I want to keep all data in several objects ,How can I create global object (global variable) .
Use your Game Instance or Game State class, you can access these classes by using “Get Game Instance” node and casting to your Game Instance, or the “Get Game State” and casting to your Game State, and then “As GameInstance” or “As GameState”, get the variable you’ve put there and do whatever with it.
This method can be done from pretty much any class you’d want to be using to get your variable (including level BP, character, playercontroller, etc.)
You can also use BP-Function-Library Getter / Setters as a layer on top of ^^ THIS ^^
There’s also “Game Singleton” class… but Epic want everyone to quit using it and switch to GameInstance instead.