unreal.LocalPlayerSaveGame
¶
- class unreal.LocalPlayerSaveGame(outer: Object | None = None, name: Name | str = 'None')¶
Bases:
SaveGame
Abstract subclass of USaveGame that provides utility functions that let you associate a Save Game object with a specific local player. These objects can also be loaded using the functions on GameplayStatics, but you would need to call functions like InitializeSaveGame manually. For simple games, it is fine to blueprint this class directly and add parameters and override functions in blueprint, but for complicated games you will want to subclass this in native code and set up proper versioning.
C++ Source:
Module: Engine
File: SaveGame.h
- classmethod async_load_or_create_save_game_for_local_player(save_game_class, local_player_controller, slot_name, delegate) bool ¶
Asynchronously loads a save game object in the specified slot for the local player, if this returns true the delegate will get called later. False means the load was never scheduled, otherwise it will create and initialize a new instance before calling the delegate if loading failed.
- Parameters:
local_player_controller (PlayerController) –
slot_name (str) –
delegate (OnLocalPlayerSaveGameLoaded) –
- Return type:
- async_save_game_to_slot_for_local_player() bool ¶
Asynchronously save to the slot and user index. This will return true if the save was requested, and errors should be handled by the HandlePostSave function after the save succeeds or fails
- Return type:
- get_invalid_data_version() int32 ¶
Returns the invalid save data version, which means it has never been saved/loaded
- Return type:
int32
- get_latest_data_version() int32 ¶
Returns the latest save data version, this is used when the new data is saved
- Return type:
int32
- get_local_player_controller() PlayerController ¶
Returns the local player controller this is associated with, this will be valid if it is ready to save
- Return type:
- get_platform_user_id() PlatformUserId ¶
Returns the platform user to save to, based on Local Player by default
- Return type:
- get_platform_user_index() int32 ¶
Returns the user index to save to, based on Local Player by default
- Return type:
int32
- get_saved_data_version() int32 ¶
Returns the game-specific version number this was last saved/loaded as
- Return type:
int32
- classmethod load_or_create_save_game_for_local_player(save_game_class, local_player_controller, slot_name) LocalPlayerSaveGame ¶
Synchronously loads a save game object in the specified slot for the local player, stalling the main thread until it completes. This will return null for invalid parameters, but will create a new instance if the parameters are valid but loading fails.
- Parameters:
local_player_controller (PlayerController) –
slot_name (str) –
- Return type:
- on_post_save(success) None ¶
Blueprint event called after saving finishes with success/failure result
- Parameters:
success (bool) –
- on_reset_to_default() None ¶
Blueprint event called to reset all saved data to default, called when the load fails or manually
- reset_to_default() None ¶
Resets all saved data to default values, called when the load fails or manually
- save_game_to_slot_for_local_player() bool ¶
Synchronously save using the slot and user index, stalling the main thread until it completes. This will return true if the save was requested, and errors should be handled by the HandlePostSave function that will be called immediately.
- Return type: