⚙️
FPS Framework
Asset StoreFab
  • Get Started
    • Welcome!
    • Setup
  • Tutorials
    • Character
      • First-Person Controller
      • Inventory
      • Firearm
        • Basics
        • Advanced
        • Other
          • Spray pattern
          • Attachment System
          • Projectile System
      • Explosive
    • Systems
      • Audio System
      • Animation System
      • Interactions
        • Pickable
      • Save System
      • Settings System
    • Tools
      • Extension Methods
    • UI
      • FPS Counter
      • Get Name
      • Image Size Fitter
  • Other
    • Full Change Log
      • 2025 Change Log
      • 2024 Change Log
      • 2023 Change Log
      • 2022 Change Log
Powered by GitBook
On this page
  • Methods
  • Example

Was this helpful?

  1. Tutorials
  2. Systems

Save System

A basic save system based on unity's JsonUtility

PreviousPickableNextSettings System

Last updated 2 months ago

Was this helpful?

The save system is built on Unity's which saves an object in a .json file. All the saves are located at which is located at C:\Users\<user>\AppData\LocalLow\<company name>on widows.

Methods

Name
Description

SaveObject

Saves the target object as a .json file in the designated save path.

LoadObject

Loads and deserializes the .json file with the specified name into the target generic type.

LoadAllObjects

Loads all .json files from the save path and deserializes them into the specified generic type.

DeleteFile

Deletes the .json file with the specified name from the save path.

DeleteAllFiles

Deletes all .json files in the save path, effectively clearing all saved data stored in that location.

Save

Saves a key with its value, similar to PlayerPrefs.SetKey(). This allows you to store data persistently between game sessions.

Load

Loads a key with its value, similar to PlayerPrefs.GetKey().

HasKey

Returns true if the Key list contains the specified key.

Example

To start using the save system, first add the FPSFramework namespace to the class you want to save and load from, like this:

using Akila.FPSFramework;

Now create a new class like this:

[System.Serializable]
public class Data
{
    public string name;
}

In Start(), call SaveSystem.Load(), and in OnApplicationQuit(), call SaveSystem.Save() inside the class you want to save and load from, like this:

public Data data = new Data();

private void Start()
{
    SaveSystem.Load<Data>("fileName");
}

private void OnApplicationQuit()
{
    SaveSystem.Save(data, "fileName");
}

Json Utility
Application.persistentDataPath