Hello, I’m new to UE4. Now I meet some questions on load game in UI blueprint.
My questions as following:
How to load game in UI blueprint? I’ve load game by LoadGameFromSlot, I can get the LevelName, PlayerLocation, but I don’t know how to use them? should I set variable in UI blueprint? But I’ve seen some suggestions that I should load game in Level Blueprint? How to?
If I load game in UI blueprint by functions that created in Level Blueprint, How to create a funtion in Level Blueprint? I don’t know how to create static function in Blueprint
If I use OpenLevel in UI Blueprint, The Character will lose its move abilitlity, shou I bind GameMode when OpenLevel ? And how to do it?
Maybe my questions are easy and stupid, but I’m really new to game programming and using UE4, could you please help me solve the questions?
Use [Open Level] node to load a level from the saved name. The issue with that is that you can’t set player location right away, because once you call the [Open Level] node, everything else stops and your widget gets destroyed. So you can open level from UI, but setting the player location should probably be done elsewhere.
For instance, create a bool variable called Is Loading and a vector variable New Location in the game instance. When you load the game from UI, set it to True. When a new level is loaded, you can check the Is Loading bool in the Game Mode, for example, because it’s being reloaded when a new level is opened. If it’s true, get the New Location from the game instance and set the player character location, then change the bool back to False.
You can’t access the level blueprint from UI or from other blueprints.