Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <syntaxhighlight lang="cpp"> bool ControllerClass::SaveGameDataToFile(const FString& FullFilePath, FBufferArchive& ToBinary) { //note that the supplied FString must be the entire Filepath // if writing it out yourself in C++ make sure to use the \\ // for example:
- // FString SavePath = "C:\\MyProject\\MySaveDir\\mysavefile.save";
- //Step 1: Variable Data -> Binary
- //following along from above examples SaveLoadData(ToBinary,NumGemsCollected,PlayerLocation,ArrayOfRotationsOfTheStars); //presumed to be global var data, //could pass in the data too if you preferred
- //No Data if(ToBinary.Num() <= 0) return false; //~
- //Step 2: Binary to Hard Disk if (FFileHelper::SaveArrayToFile(ToBinary, * FullFilePath)) { // Free Binary Array ToBinary.FlushCache(); ToBinary.Empty();
- ClientMessage("Save Success!"); return true; }
- // Free Binary Array ToBinary.FlushCache(); ToBinary.Empty();
- ClientMessage("File Could Not Be Saved!");
- return false; } </syntaxhighlight>
- FBufferArchive
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement