UGameplayStatics::DeleteGameInSlot
#include "Kismet/GameplayStatics.h"
Access: public
Specifiers: staticUFUNCTIONBlueprintCallable
Description
Deletes the save game file associated with a given slot name. Returns true if the file was deleted; returns false if the slot did not exist or deletion failed.
Caveats & Gotchas
- • A false return does not distinguish between 'slot never existed' and 'deletion failed due to permissions or I/O error' — call DoesSaveGameExist first if you need to tell these apart.
- • This is a synchronous file operation on the game thread; on platforms with slow storage it can cause a visible hitch. For production use, consider wrapping it in an async task.
Signature
static ENGINE_API bool DeleteGameInSlot(const FString& SlotName, const int32 UserIndex); Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| SlotName | const FString& | Name of the save slot to delete. | — |
| UserIndex | const int32 | Platform user index; ignored on some platforms (pass 0 on PC). | — |
Return Type
bool Example
Delete a save slot from a UI menu C++
bool bDeleted = UGameplayStatics::DeleteGameInSlot(TEXT("SaveSlot_1"), 0);
if (!bDeleted)
{
UE_LOG(LogTemp, Warning, TEXT("Failed to delete save slot — may not have existed."));
} See Also
Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?