Game Framework
Game Framework
Section titled “Game Framework”A collection of prebuilt systems and extension features that is designed to speed up game development in Unity.
This framework is organized around the central static class GameFramework.Core,
which contains a variety of managers and systems.
UPM Installation
Section titled “UPM Installation”- Open Unity Package Manager (
Window > Package Manager). - Click the
+icon in the upper-left corner and selectAdd package from git URL.... - Enter the following URL:
https://github.com/achieveonepark/game-framework.git
Dependencies
Section titled “Dependencies”This framework depends on several external packages to use its full feature set.
Required
Section titled “Required”- UniTask:
Required for asynchronous operations across the framework.
It must be installed before installing the Game Framework package.
Optional
Section titled “Optional”The following packages can be installed optionally to enable additional features.
- UniTaskPubSub:
Enables theUIBindingManagerfeature for reactive (event-based) UI. - QuickSave:
Enables data persistence forCore.Player.
To use it, you must addUSE_QUICK_SAVEto the project’s Scripting Define Symbols.
Features & API
Section titled “Features & API”Most modules in the framework are provided
as nested classes inside the static class GameFramework.Core.
Access Patterns
Section titled “Access Patterns”- Static Classes
Access them directly (e.g.Core.Time.TimeScale) - MonoBehaviour Singletons
Access them through theInstanceproperty
(e.g.Core.Sound.Instance.PlayBGM())
→ The corresponding GameObject must exist in the scene.
System Modules
Section titled “System Modules”| Class | Access | Description |
|---|---|---|
Core.Log | Static | Handles console log output at multiple levels. |
Core.Config | Static | Manages key-value settings stored in PlayerPrefs. |
Core.Player | Static | Central runtime player-data manager based on containers. |
Core.Time | Static | Controls global time scale and provides the current time. |
Core.Scene | Singleton | Manages scene loading and unloading. |
Core.Popup | Singleton | Manages UI popup creation and lifecycle. |
Other Features
Section titled “Other Features”- Utility and extension methods
Provides various extension methods for Unity and core C# types.
See theRuntime/Extensionsfolder. - UI components
Includes UI helper components such asSafeAreaandDraggable.
Quick Start Examples
Section titled “Quick Start Examples”Core.Log
Section titled “Core.Log”Handles categorized console logs.
Core.Log.Debug("This is a debug message.");Core.Log.Info("This log is for important information.");Core.Log.Warning("A problem may occur.");Core.Config
Section titled “Core.Config”Manages simple data stored in PlayerPrefs.
// Set an initial value if the key does not exist.Core.Config.AddKey("BGMVolume", 0.8f);
// Set and get a value.Core.Config.SetConfig("BGMVolume", 0.7f);float currentVolume = (float)Core.Config.GetConfig("BGMVolume");Core.Player (Data Management)
Section titled “Core.Player (Data Management)”Manages runtime data through container classes.
- Define data and container
// Actual data structure.public class CharacterData : PlayerDataBase{ public string Name; public int Level;}
// Container that holds the data.public class CharacterDataContainer : PlayerDataContainerBase<int, CharacterData>{ public CharacterDataContainer() { // Important: to use GetContainer<T>, // DataKey must match the class name. DataKey = typeof(CharacterDataContainer).Name; }}- Register and use the container
// Create and register the container when the game starts.var characterContainer = new CharacterDataContainer();characterContainer.Add(1, new CharacterData { Id = 1, Name = "Hero", Level = 1 });Core.Player.AddContainer(characterContainer);
// Retrieve and use the data elsewhere.var myChars = Core.Player.GetContainer<CharacterDataContainer>();var mainChar = myChars.GetInfo(1);mainChar.Level++;
// Save / load all data (requires USE_QUICK_SAVE)Core.Player.Save();Core.Player.Load();Core.Popup (Singleton)
Section titled “Core.Popup (Singleton)”Requires a PopupManager GameObject with the Core.Popup script and a popup prefab list.
// Open a specific type of popup registered in the manager.// Open() is called automatically.var myPopup = Core.Popup.Instance.Open<MyAwesomePopup>();
// Pass data when opening a popup.var data = new MyPopupData { Message = "Hello!" };Core.Popup.Instance.Open<MyAwesomePopup>(data);
// Close the popup.myPopup.Close();Core.Time
Section titled “Core.Time”A wrapper class around Unity’s Time and a DateTime fetched from a pinged server time.
// Set game speed to 2x.Core.Time.TimeScale = 2.0f;
// Get the current real time.DateTime now = Core.Time.Now;