Skip to main content
26 votes
Accepted

How can I implement persistent state for objects defined in a level?

I think not overthinking this issue will give the best results so I would just implement a simple key-value saving system into your game that you store along your other save data and then load on-...
Charanor's user avatar
  • 7,870
15 votes
Accepted

What Situations is Saving a Game to Main Memory for?

Sometimes you might want to store your savegame data somewhere else than on the users hard drive. You might offer a cloud save service, for example. In that case you would use ...
Philipp's user avatar
  • 120k
10 votes

How can I save game "professionally"?

Text files are a perfectly fine way to create savegames. It's easy to implement and it allows you as the developer to edit savegame files in a text editor in order to test things more quickly. But for ...
Philipp's user avatar
  • 120k
9 votes
Accepted

What is the reason that people avoid PlayerPrefs to store character data and coins etc?

As implied by the name, PlayerPrefs is mostly intended for storing config options. But it can also be abused to store savegame data, if that data is rather small. If you target platforms without write-...
Philipp's user avatar
  • 120k
7 votes
Accepted

Is there a game-design related reason why games with checkpoints don't implement "save on exit" as well?

I think Tooster's answer covers most of the important points, but I do want to elaborate on a couple of details. Maintaining Flow This builds on Tooster's references to "context" that can be ...
DMGregory's user avatar
  • 135k
6 votes
Accepted

How do open-world game saves work?

Your hunch is pretty much spot on. Games like skyrim will save the orientation, speed, and all other physics for each object. Some games will speed this process up by skipping over distant object and ...
Dan's user avatar
  • 276
5 votes
Accepted

Unity - How to create a game-save with a preview image?

Since you're working with JSON format already, you could simply include the preview image as a Base64 blob that can be decoded on the fly when reading the savegame list. Assuming you have access to a ...
liggiorgio's user avatar
  • 4,866
4 votes
Accepted

Implementing Skyrim's save system in Unity

Skyrim actually does not look like it uses an individual record for every enetity on the screen. It actually seems like it does something a little less creative and more robust. If you take a look at ...
moonshineTheleocat's user avatar
4 votes
Accepted

Unity - PlayerPrefs.SetString appears to save garbage data

This happens because Unity does not directly write the string to the PlayerPrefs file, instead, it serializes it into a format which can be saved without conflicting with the XML. For example, it ...
Aaron Franke's user avatar
4 votes
Accepted

Persisting Data with C#

Let's work though this logically: dataObject.cap1v prints zero. But in the path where no save file was found, we set it to 3. So (barring outside interference) we ...
DMGregory's user avatar
  • 135k
4 votes

LibGDX Json writes only part of class

Well I fixed my issue that I was having. Instead of using libGDX Json to write to file from the class I used JSONObject and used put() and surrounded it with try and catch to write the ...
Finnrir's user avatar
  • 63
4 votes
Accepted

Is this a reasonable method of detecting JS memory hacks?

Yes, your strategy for detecting manipulation of the runtime forgets that it is also possible to override the toString method of any function. After the cheater ...
Philipp's user avatar
  • 120k
4 votes

How can I implement versioning into a save system?

You could add a version number to your savegame file format itself. The savegame loader loads the savegame file as plain data, checks the version number which it expects in a specific position and ...
Philipp's user avatar
  • 120k
4 votes
Accepted

How could I intercept a save scene action being run in Unity?

Unity already has a built-in event for doing exactly what you want: EditorSceneManager.sceneSaving Usage: ...
Kevin's user avatar
  • 6,235
4 votes

Is there a game-design related reason why games with checkpoints don't implement "save on exit" as well?

I think this is a bit too shallow of a viewpoint focusing only on the player's perspective. It would be better If you posted more examples of games doing it first and the latter way. It's hard to say ...
Tooster's user avatar
  • 308
3 votes
Accepted

How to save and load scene in realtime?

I believe you are talking about serializing MonoBehaviours. This is something we have struggled with since the dawn of humankind. There are third party tools available on the asset store, but they ...
Evorlor's user avatar
  • 5,803
3 votes

Updating Json files in a Unity game - What am I doing wrong?

JSON is a string-based format. When you change the length of something in a JSON file (for example by changing "CurrentHP": 99 to ...
Philipp's user avatar
  • 120k
3 votes
Accepted

How to build a better game save?

Your game save is already in JSON form, as a two dimensional array, but it is the most verbose possible way of representing the data. Some notes: You are looking to make your format more concise, ...
MrCranky's user avatar
  • 6,058
3 votes
Accepted

Confused about how specific bools or flags are actually accessed and used by other scripts

For saving the state of multiple objects like this, there's a lot of different techniques you can use depending on just how extensible you'd like this to be. I'd of course recommend storing all of ...
domportera's user avatar
3 votes
Accepted

Actual time-based plant growth even when game is off

All the different ways where and how to store savegame data in Unity are already covered well enough by many other questions on this website, so I won't get into that aspect. I will instead focus on ...
Philipp's user avatar
  • 120k
3 votes

How do I save data for multiple things sharing the same script?

Let us talk about inventories. Real world inventories. An object in a store have a unique id (e.g. a Serial Number) and a model (e.g. "Rusted Sword 2000"). And there might be other ...
Theraot's user avatar
  • 27.2k
2 votes

Saving player's progress in a Unity game

Unfortunately Unity does not have a build-in savegame system. So every game needs to develop an own savegame system which is tailored to the architecture and requirements of that specific game. That ...
Philipp's user avatar
  • 120k
2 votes

How do I implement a retro-style password-based "savegame" system?

Well you could basically do it this way: Bosses killed = 7 Amount of coins = 36 Owns Sword = 0(No) Owns Heart = 1(Yes) Current Level = 6 Current World = 9 Health = 100 Code = 7V36R0A1T6O9A100 ...
aanda tv's user avatar
2 votes

How to save and load animation curves recorded at runtime?

If you go to the definition of AnimationCurve (F12 in VS), you'll see that it is not marked [System.Serializable] and no amount ...
Jon's user avatar
  • 3,704
2 votes

Is it bad practice to store inventory and scores in PlayerPrefs?

I had issues with PlayerPrefs() on Tizen device. Same game Worked great on Android and iOS. It's good practice using XmlSerializer or Binary Serialization. They have better control when dealing with ...
Sourav Paul Roman's user avatar
2 votes

Is it bad practice to store inventory and scores in PlayerPrefs?

Yes, because PlayerPrefs are VERY unsecure. If you get into the habit of using PlayerPrefs to store data, even for games where it doesn't matter, then you'll run the risk of doing it when it does ...
DisturbedNeo's user avatar
2 votes

game resuming stats password

First, consider the alternatives. When this is a game running as an executable application, you should be able to create a savegame. When this is a web-based game where you don't have access to the ...
Philipp's user avatar
  • 120k
2 votes
Accepted

How to securely store xml/json information about actors in a game?

You could use JSON and zip it with a password (encrypt), then use a runtime zip library like DotNetZip to extract it for inspection by the game only, no-one else. Or you could access it on a secured ...
Engineer's user avatar
  • 30k

Only top scored, non community-wiki answers of a minimum length are eligible