# C++ UGameplayStatics::SaveGameToSlot Crash

**URL:** <https://forums.unrealengine.com/t/c-ugameplaystatics-savegametoslot-crash/413389>\
**Category:** Editor Scripting\
**Tags:** savegame, unreal-engine, crash, question, CPP\
**Created:** [December 30, 2017, 3:42am UTC](https://forums.unrealengine.com/t/c-ugameplaystatics-savegametoslot-crash/413389 "2017-12-30T03:42:56Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ShankIsUsed](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ShankIsUsed](https://forums.unrealengine.com/u/ShankIsUsed)\
**Post date:** [December 30, 2017, 3:42am UTC](https://forums.unrealengine.com/t/c-ugameplaystatics-savegametoslot-crash/413389/1 "2017-12-30T03:42:56Z")

</div>

Hey, guys. I am trying to make a saved game by using UGameplayStatics::SaveGameToSlot. It works all fine from the begining until some day, I delete the saved file, and try to test the save game function again, it crashed on UGameplayStatics::SaveGameToSlot. I made a small test program like the following code, and make them execute at once when I hit play.

```
    FPlayerProfile playerProfileSave;
	playerProfileSave.mPlayerName = FText::FromString(TEXT("haha"));

	USaveGame_TheLastBastion* mSaveGame = nullptr;
	if (mSaveGame == nullptr)
		mSaveGame = Cast<USaveGame_TheLastBastion>(UGameplayStatics::CreateSaveGameObject(USaveGame_TheLastBastion::StaticClass()));

	if (mSaveGame)
	{
		mSaveGame->SetPlayerProfile(playerProfileSave);

		UGameplayStatics::SaveGameToSlot(mSaveGame, TEXT("Save"), 0);
	}

```

It still crashes. By using the debug symbol, it leads to this. Anyone know whats happened?

 ![225435-capture.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/a/a/d/aad5613e068015e603e64f10d6f7b2c451c6a5d1.jpeg)

---

<div class="post-metadata">

**Author:** ![ShankIsUsed](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ShankIsUsed](https://forums.unrealengine.com/u/ShankIsUsed)\
**Post date:** [December 31, 2017, 9:14pm UTC](https://forums.unrealengine.com/t/c-ugameplaystatics-savegametoslot-crash/413389/2 "2017-12-31T21:14:49Z")

</div>

Problem Solved, I have to set everything that needs to stored as UPROPERTY

---

<div class="post-metadata">

**Author:** ![krvc84](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@krvc84](https://forums.unrealengine.com/u/krvc84)\
**Post date:** [March 21, 2023, 6:51am UTC](https://forums.unrealengine.com/t/c-ugameplaystatics-savegametoslot-crash/413389/3 "2023-03-21T06:51:19Z")

</div>

I have in my save

UPROPERTY(BlueprintReadWrite, Category = “Audio”)  
float AudioMainVolume = 1.f;

But it always crash too. Its work fine in Editor - save, load. But after package its - crash crash crash and crash.
