This library is an extension for SUCC which adds generic DataFile types. These new types let you save and load data without using any magic strings.
Before:
DataFile File = new DataFile("game.succ");
void SaveHighscore(int score)
=> File.Set("highscore", score);
int LoadHighscore()
=> File.Get<int>("highscore");After:
public interface IFileData
{
int Highscore { get; set; }
}
DataFile<IFileData> File = new DataFile<IFileData>("game.succ");
void SaveHighscore(int score)
=> File.Data.Highscore = score;
int LoadHighscore()
=> File.Data.Highscore;InterSUCC requires SUCC and ClassImpl.
InterSUCC can be installed via the Unity Package Manager. To do so, add the following to the dependencies array in your manifest.json:
"com.jimmycushnie.intersucc": "https://github.com/JimmyCushnie/InterSUCC.git#unity"Due to the nature of InterSUCC's implementation, there's no way to set a default value as you're loading a value. Therefore, it is recommended that you set default values for your files using the Default Files feature.
Todo document this feature