🍬
Candy Merge
  • Welcome
  • Getting Started
    • Quickstart
    • ‼️Installation Guide
  • Settings & Configuration
    • Runtime Settings
    • Editor Settings
    • Game Settings
    • Camera Settings
    • Candy Settings
    • Player Settings
  • SYSTEMS
    • Candies
    • Game Over
    • Level
    • Managers
    • Menu
    • Pause
    • Save
    • Transition
    • UI Components
    • User
Powered by GitBook
On this page
  • Saves System
  • Overview
  • Classes
  1. SYSTEMS

Save

PreviousPauseNextTransition

Last updated 2 months ago

Saves System

Overview

The Saves system is responsible for managing the saving and loading of game data in the Candy Merge game. This includes handling the storage and retrieval of player preferences and game state using various save mechanisms. The system ensures that game data is persisted correctly and can be retrieved when needed.

Classes

SaveManager

Manages saving and loading game data using a specified save system. This class is a singleton that handles the overall save and load operations, ensuring that data is stored and retrieved correctly.

Key Responsibilities:

  • Initializing Save System: Initializes the save system on awake.

  • Saving Data: Provides methods to save data as different types (string, int, float).

  • Loading Data: Provides methods to load data as different types (string, int, float).

Example Use Cases

  1. Saving Game Data: The class provides methods to save game data, such as player progress or settings, using a specified save system.

  2. Loading Game Data: The class provides methods to load game data, ensuring that the game state is restored correctly when the player returns.

PlayerPrefsSave

Key Responsibilities:

  • Saving Data: Saves data to PlayerPrefs based on the data type (string, int, float).

  • Loading Data: Loads data from PlayerPrefs based on the data type (string, int, float).

Example Use Cases

Data

Represents a data object containing a key-value pair to be saved. This class is used to encapsulate the data that needs to be stored or retrieved.

Key Responsibilities:

  • Storing Key-Value Pairs: Encapsulates the key-value pairs to be saved or loaded.

Example Use Cases

ISave

An interface that defines the methods for saving and loading data. This interface is implemented by classes that handle the actual storage and retrieval of data.

Key Responsibilities:

  • Defining Save Methods: Provides method signatures for saving data.

  • Defining Load Methods: Provides method signatures for loading data.

Example Use Cases

By using the Saves system, you can manage the persistence of game data in the Candy Merge game, ensuring that player progress and settings are stored and retrieved correctly, providing a seamless and consistent gameplay experience for players.

Handles saving and loading player data using Unity's PlayerPrefs. This class implements the interface and provides methods to store and retrieve data using PlayerPrefs.

Saving Player Preferences: The class saves player preferences, such as audio settings or control configurations, using PlayerPrefs.

Loading Player Preferences: The class loads player preferences, ensuring that the settings are restored correctly when the game starts.

Creating Data Objects: The class is used to create data objects that contain the key-value pairs to be saved or loaded by the save system.

Implementing Save Systems: The interface is implemented by classes like to handle the actual saving and loading of data.

SaveManager
SaveManager
ISave
PlayerPrefsSave
PlayerPrefsSave
Data
ISave
PlayerPrefsSave