Skip to content

A simple implementation for game data saving and loading in unity

License

MIT, Unknown licenses found

Licenses found

MIT
LICENSE
Unknown
LICENSE.meta
Notifications You must be signed in to change notification settings

luisoliveiras/game-data-maker

Repository files navigation

Game Data Maker

GitHub package.json version

What is this?

Game Data Maker is a simple implementation of data saving and loading to a binary file. It provides a simple configuration editor, methods for saving, loading and deleting and callbacks on success or failure for each of those methods.


Installation:

On Unity 2018.4:

Download this package to your disk. Open the package manager on Window > Package Manager and select the + button and click on the Add package from disk... option.

  • Add the GameDataMaker package.
On Unity 2019.1 and above:

Open the project manifest file under the Packages folder and add these lines to the dependencies:

"dependencies": {
    "com.loophouse.game-data-maker":"https://github.com/luisoliveiras/game-data-maker.git",
}
On Unity 2019.3 and above:

Open the package manager on Window > Package Manager and select the + button and click on the Add package from git URL... option.

* You can also add it from disk if you want, just follow the steps from 2018.4 install guide.


How To Use:

Configuration Window

Access the menu Tools > Game Data Maker to open the game Data Maker configuration editor. If no SaveConfig File was created it will create a new one under Assets > Resources.

Config Window

Show Logs: Use the Show Logs checkbox to enable/disable the logs from the Game Data Maker.

Game Data Items: The game data items represents a file and path where it will be saved. The Name property used to access it from code. The Path contains a folder (optional), a file name and a extension, and defines where the file will be saved and loaded from.

* The CustomPath class uses the Application.persistentDataPath to define the parent folder of the file.

Game Data Manager

The GameDataManager is the class used to access the save data and have 3 main methodsfor that:

Save: void Save<T>(T data, string item) Serializes T to a binary file (T and its attributes must be serializable) in the path set for the item (name of the Game Data Item in the config file). Invokes OnSaveSuccess when the file is successfully saved, and OnSaveFail when there is a problem.

Load: T Load<T>(string item) Deserializes the file from the path set for the item. Invokes OnLoadSuccess when the file is successfully loaded and OnLoadFail when there is a problem loading the file.

Delete: void Delete(string item) Deletes the file from the path set for the item. Invokes OnDeleteSuccess when it deletes the file and OnDeleteFail when it is unable to delete it.


Samples:

Example 01:

What: Contains a basic implementation of save, load and delete, using the Game Data Maker tool.

How: Import the Example 01 sample from the Package Manager UI. Open the Example01 scene inside the folder added to your project's Assets folder and you're ready to go.

About

A simple implementation for game data saving and loading in unity

Topics

Resources

License

MIT, Unknown licenses found

Licenses found

MIT
LICENSE
Unknown
LICENSE.meta

Stars

Watchers

Forks

Packages

No packages published

Languages