SAVE & LOAD SYSTEM in Unity
Why Stack Overflow recommends it
Stack Overflow users link it when answering how to persist player data, scores or settings in Unity, usually recommending file-based saving over PlayerPrefs.
Recommended by 7 people across 5 different months, 2019 to 2023.
Why Game Development Stack Exchange recommends it
Game Development Stack Exchange answerers point people to it when asked how to persist player or scene data between sessions in Unity.
Recommended by 2 people across 2 different months, 2020 to 2021.
What it is
A Brackeys tutorial on saving and loading game data in Unity. It walks through serializing data classes to a binary file with BinaryFormatter and reading it back, as an alternative to PlayerPrefs. It is presented by Brackeys, a popular Unity education channel.
What people said
Recommends kode sensei · 2019-12 · Stack Overflow · on “How can my users add sprite and image resources once my app is deployed?”
The best way to do this is to save changes to the disk. .Net has the System.IO namespace for you to use for reading and writing to disk. Because you can write to the disk during run time there will be no problems calling those resources. You can check Brackeys on YouTube they teach a lot if you are new to unity here is how you save and load data in unity [this video]
Recommends Bipin · 2020-10 · Stack Overflow · on “How can I share scores via 2 scenes in Unity”
class ScoreKeeper{ public static float HighScore; } //where you update player score ScoreKeeper.HighScore= 10;//Score Value //Where you want to fetch score Debug.Log(ScoreKeeper.HighScore); Explanation: Just create a class (non Mono behaviour) and use static variable to hold scores which can be accessed across multiple Scene. As far as PlayerPrefs are concerned you are better off using Binary Files [this video] Here is a great explaination.
Recommends Lucas McCully · 2020-10 · Stack Overflow · on “PlayerPrefs not working on android device”
I would recommend staying away from player prefs all together and instead saving to a file. Player prefs is very limited in what it can save and has problems with creating garbage files. Saving to a file allows for storage of much more information in a neater fashion as well as being a better practice to follow. Here's a Brackeys tutorial [this video] on how to save and load to a file.
Recommends Poula Reda · 2021-01 · Game Development Stack Exchange · on “Persisting Player Prefs On Build in Android”
You can just create a game object and add a script to it and on the Start() method just call the PlayerPrefs and set the values you want. Now keep in mind that PlayerPrefs are only 1 megabyte of free local storage that you get. Thats why its called PlayerPrefs , its the preferences of the player, like sound settings, music settings, etc. Things that are usually small to store. You can also just create a json file into the build with classes and the values you want to save and read and write to that json file the values you want. Or like the YouTuber Brackeys did with saving and loading game. Here is the video: [this video]
Recommends Stefan · 2021-08 · Game Development Stack Exchange · on “How to save / load a scene in unity?”
There are a few way you can persist data between sessions. To simply name a few you can use playerprefs or a simple file format like xml or json or custom binary files. As a very simple example, at certain stages in your game (e.g. when a user finishes a level) you can save in a file a number associated with that level (lets say as in your case, 10). If he closes the game and relaunches it, you can load that 10 from the file in the main menu and further see what you want to do with it. (you might want to look into SceneManager.LoadScene(sceneANumber); ) Brackeys had a very nice video explaining those methods step by step if interested: [this video] The last resort would be to use a package such a
Recommends Abdelkrim · 2021-10 · Stack Overflow · on “How can I save player data in Unity?”
There is no one single question for this, saving data in unity is just like saving data in every running program. I'll try to enumerate some of the methods : PlayerPrefs : As @KaushikChandru already answered you can use player prefs to save the data, just serialize them and save them as a String, and then you can deserialize them to get them back as objects. File : Instead of using a PlayerPrefs you can use a File instead, here is a useful video that explains that ( here [this video] ) Use a database (sql lite) : The second one would be to use a database (local or remote). I suggest using SQL Lite, here is a useful tutorial for that ( here [LINK] )
Recommends ADS · 2022-06 · Stack Overflow · on “How to save and load selected Dropdown values in unity”
You could use unity's player prefs system below is a link to documentation on how it works. Unity player prefs documentaion [LINK] Alternatively you could create your serialisation system here's a Brackey's video which shows how to make a basic class serialisations system [this video] For what your trying to do the fastest and quickest approach would be to just use player prefs for saving and loading the int value.
Recommends ShahabBidi · 2022-06 · Stack Overflow · on “how to make class variables not reset when closing unity”
i use this video. Save load system in unity [this video] in this way you need to save variables to binary file. but i tested and it works good.
Recommends Divyesh Thirukonda · 2023-04 · Stack Overflow · on “Is there any way for me to save my Unity game using the SceneManager class or some other feature like it?”
In that case, you could save to the local file system in a .dat file. You would use a binary file formatter. Refer to Brackey's video on saving and loading: [this video]
Cites Wzrd · 2019-03 · Stack Overflow · on “DirectoryNotFoundException: Could not find a part of the path. (C# - Unity)”
I am trying to save some simple user data, following this [this video] tutorial. I am building for Android. On the first compilations, everything worked fine. However - I came back to my project today and I got the following error: (I have done some work since then, but I cannot think what has changed to cause the problem). DirectoryNotFoundException: Could not find a part of the path "C:\Users\Ben\AppData\LocalLow\Top Notch Development\Simple Swim\Log:71.test". System.IO.FileStream..ctor (System.String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, Boolean anonymous, FileOptions options) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.IO/FileStream.