Skip to content

rs0125/Lockbox

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LockBox

A production-grade save system for Unity with encryption, compression, and multi-profile support.

Overview

LockBox provides a static API for persisting game data with AES-256 encryption, GZip compression, and automatic type serialization. Supports primitives, collections, Unity types (Vector3, Quaternion, Color), custom classes, and multidimensional arrays up to 6D.

Key Features

  • AES-256 Encryption: Secure save files with CBC mode and random IV
  • GZip Compression: Reduces file size by approximately 80%
  • Multi-Profile System: Multiple save slots with isolated data
  • Auto-Save: Configurable interval-based and exit-triggered saves
  • Type Support: Primitives, Lists, Arrays (1D-6D), Unity structs, custom classes, SerializableDictionary
  • Async Operations: Non-blocking save operations for large datasets
  • Backup System: Automatic 3-tier backup rotation
  • Thumbnail Support: Screenshot capture for visual save slot previews
  • Version Management: Built-in save migration system
  • WebGL Compatible: localStorage integration via jslib
  • Editor Debugger: GUI tool for inspecting and editing save files
  • Zero Dependencies: No third-party libraries required

Installation

  1. Import the package into your Unity project
  2. Create a Resources folder in Assets if it doesn't exist
  3. Right-click in ResourcesCreate → LockBox → Settings
  4. Configure encryption key (must be 16, 24, or 32 characters)
  5. Add using UnityEngine; and start using LockBox.Save() / LockBox.Load()

Quick Start

using UnityEngine;

public class GameManager : MonoBehaviour
{
    void Start()
    {
        // Save data
        LockBox.Save("PlayerName", "Alice");
        LockBox.Save("Score", 1000);
        LockBox.Save("Position", new Vector3(10, 5, 10));
        LockBox.SaveDisk();
        
        // Load data
        string name = LockBox.Load<string>("PlayerName");
        int score = LockBox.Load<int>("Score", 0); // Default value: 0
        Vector3 pos = LockBox.Load<Vector3>("Position");
    }
}

Supported Platforms

  • Windows, Mac, Linux
  • iOS, Android
  • WebGL (requires jslib plugin)
  • Console platforms (tested on Switch, PlayStation, Xbox)

Performance

  • Save operation: ~2ms for 1000 Vector3 entries (with compression + encryption)
  • Load operation: ~1ms for 1000 Vector3 entries
  • File size: 2.4KB for 1000 Vector3 entries (compressed), 40KB uncompressed

License

MIT License - See LICENSE file for details

Documentation

See Documentation.md for complete API reference and advanced usage.

About

Multi-Parameter JSON Serialization and Encryption Middleware for Unity

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors