-
-
Notifications
You must be signed in to change notification settings - Fork 59
Home
Hasan Bayat edited this page Jun 4, 2017
·
8 revisions
Welcome to the Save Game Free wiki! Here you will learn how to use the save game free in your unity games.
The Save Game Free contains features that help you in the save and load process like:
- Simplicity
- Free to Use
- Easy to Use
- Powerful
- Fast
- Lightweight
- Custom Serializer
Easily in your script when your game gets initialized like (Manager e.g. GameManager):
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using SaveGameFree;
public class GameManager : MonoBehaviour
{
public const string MY_GAME_DATA_FILE_NAME = "myGameData";
[Serializable]
public class MyGameData
{
public int score = 0;
public string playerName = "";
}
public MyGameData myGameData;
void Awake ()
{
Saver.OnSaved += Saver_OnSaved;
Saver.OnLoaded += Saver_OnLoaded;
Saver.InitializeDefault ();
myGameData = Saver.Load<MyGameData> ( MY_GAME_DATA_FILE_NAME );
}
void Saver_OnLoaded ( object obj )
{
MyGameData myGameDataLocal = obj as MyGameData;
Debug.LogFormat ( "Loaded Succescully: {0}", myGameDataLocal );
}
void Saver_OnSaved ( object obj )
{
MyGameData myGameDataLocal = obj as MyGameData;
Debug.LogFormat ( "Saved Succescully: {0}", myGameDataLocal );
}
}
How to Create Custom Serializer?
📖 Issues and file your issue.
MIT @ Bayat
Made with ❤️ by Bayat