Link to asset store: Auto Magic
Price: $15 USD
How many times have you made a game only to get to the saving part of it and had to write out line after line using PlayerPref.Set whatever. Then when there is other variables you add in later you have to go back and write more save and load lines. There is now a SIMPLE and EASY way to save all your variables.
I give you…Auto-Magic! With the Auto-Magic save system you now NEVER have to worry about writing a save system again. Just write all your variables into a static class that is provided for you and then when you need to save or load you just have to make one call to the save or load function. It’s that simple. No more manually writing out lines of code again.
[THE OLD WAY]
Example 1: John has 10 variables he wants to save for his game. Here is a sample of what John’s code would look like using the standard way…
public class Saving : MonoBehaviour
{
void Save()
{
PlayerPrefs.SetInt("variable1", 1);
PlayerPrefs.SetInt("variable2", 2);
PlayerPrefs.SetInt("variable3", 3);
PlayerPrefs.SetInt("variable4", 4);
PlayerPrefs.SetInt("variable5", 5);
PlayerPrefs.SetInt("variable6", 6);
PlayerPrefs.SetInt("variable7", 7);
PlayerPrefs.SetInt("variable8", 8);
PlayerPrefs.SetInt("variable9", 9);
}
void Load()
{
int var1 = PlayerPrefs.GetInt("variable1");
int var2 = PlayerPrefs.GetInt("variable2");
int var3 = PlayerPrefs.GetInt("variable3");
int var4 = PlayerPrefs.GetInt("variable4");
int var5 = PlayerPrefs.GetInt("variable5");
int var6 = PlayerPrefs.GetInt("variable6");
int var7 = PlayerPrefs.GetInt("variable7");
int var8 = PlayerPrefs.GetInt("variable8");
int var9 = PlayerPrefs.GetInt("variable9");
}
}
[THE AUTO-MAGIC WAY]
Same Example as John’s using Auto-Magic
public static class Variables
{
public static float variable1 = 0;
public static float variable2 = 0;
public static float variable3 = 0;
public static float variable4 = 0;
}
public class Saving : MonoBehaviour
{
void Save()
{
SavedVariables.SaveVariables();
}
void Load()
{
SavedVariables.Load();
}
}
As you can see using Auto-Magic you can greatly increase the speed in which you want to save and load variables. Auto-Magic also allows you to save under multiple locations for games that may have multiple save slots using the same functions as before
[SAVING MULTIPLE FILES]
public class Saving : MonoBehaviour
{
int index = 1;
void Save()
{
SavedVariables.SaveVariables(index);
}
void Load()
{
SavedVariables.Load(index);
}
}
Auto-Magic also comes with a built in Editor Window that allows you to view all your saved variables. No more guess what a saved variables is or having to write out tedious log code to output what you saved. With the built in editor you can also manipulate data to change or tweak saved data.
[LIMITATIONS]
While the Auto-Magic is pure awesome saving power, it does have a few set backs. It uses Unity’s built in Player Prefs system so XML or any other kind of saving is not going to work unless you write the code yourself to get it too work. Also there is a set amount of types that you can save, which are the following…
- float
- double
- int
- bool
- string
- Vector2
- Vector3
- List
- List
- List
- List
- List
- List(version 1.01)
- List(version 1.01)
Saving has never been easier to do with Auto-Magic. Weather you are new to unity or have been developing for years, Auto-Magic will make a great addition to your library for each project you do.
If you have any questions please feel free to email me @ drobinson@taptoongames.com
Link to asset store: Auto Magic
Price: $15 USD
TL;DR = Make static variables, make 1 call to save and load variables, never write another save script EVER!