GitHunt
SI

SinlessDevil/ZenjectTemplate

Modular Zenject-based Unity template with built-in architecture, services, โ€” ready for mid-core or hybrid-casual projects.

๐Ÿงฉ Unity Zenject Template

A clean, modular Unity template built on Zenject, designed for scalable game projects. Includes core services, state machine, tool integrations, URP setup, and a full test suite.

โœจ Features

  • ๐Ÿง  State Machine (Game Flow) โ€” Bootstrap โ†’ Load โ†’ Menu โ†’ Game โ†’ Win/Lose
  • ๐Ÿ—๏ธ Factory Services โ€” UI, Game, Widget, and Scene instantiation
  • ๐Ÿ“Š Static Data System โ€” Loadable config data for sounds, levels, etc.
  • ๐Ÿ“ฆ Save System Toolkit โ€” PlayerPrefs / JSON / XML + Editor tool
  • ๐Ÿ”Š Audio & Vibration Kit โ€” Music, 2D/3D sounds, haptics with pooling
  • ๐Ÿงช Built-in Test ToolKit โ€” Scene/prefab/enum/guid validation
  • ๐ŸŽจ URP + Toony Colors Pro โ€” Stylized rendering preset
  • ๐Ÿž SRDebugger โ€” Integrated in-game debug UI
  • ๐Ÿ“ Modular Structure โ€” Clean separation into Code, Plugins, Tests, Resources

๐Ÿงช Test Coverage

EditMode:

  • GuidDuplicationTest โ€” detects duplicate .meta GUIDs
  • ResourcesPrefabValidationTests โ€” checks for missing scripts in Resources prefabs
  • SceneValidationTests โ€” verifies scenes for:
    • missing scripts
    • missing prefab links
    • null fields on serializable components
  • Enum Tests โ€” ensures enum-to-data mapping is valid
  • LevelService Tests โ€” validates level selection and local progress logic
  • StorageService Tests โ€” checks key-value consistency

PlayMode:

  • WidgetProvider Tests โ€” tests prefab resolution and instantiation

๐Ÿ“ฆ Included Tools

โœ… Entry Point

The BootstrapInstaller (via Zenject) wires up:

  • Core services (UI, Level, SaveLoad, Storage, Audio)
  • Game StateMachine & States
  • Static Data loaders
  • Coroutine runner and loading curtain

๐Ÿ“ Architecture Overview

The project is structured with a modular architecture, using Zenject as the Dependency Injection framework. It is designed to support mid-core and hybrid-casual projects out of the box. Below is an overview of the core systems and services:

๐Ÿ“† Core Components

  • ๐ŸŒ€ Game State Machine
    A flexible state machine with separate classes for each game state:
    • BootstrapState, LoadProgressState, LoadMenuState, LoadLevelState, GameLoopState, etc.
  • ๐Ÿ  Game/UI Factories
    Centralized services for creating gameplay entities and UI windows.
  • ๐Ÿ“ Static Data System
    Configurable data loading system using ScriptableObjects. Includes support for gameplay configuration and audio/vibration settings.
  • ๐Ÿง  Services Layer
    Decoupled services for all game-related logic:
    • Level Management (LevelService)
    • Save/Load Progress (UnifiedSaveLoadFacade)
    • UI & Windows (WindowService)
    • Input Handling (InputService)
    • Random Generator (RandomService)
    • Time Management (TimeService)
    • Widget System (WidgetProvider)
    • Storage Logic (StorageService)
  • ๐ŸŽฎ Win/Lose System
    Includes WinService and LoseService for handling end-of-level logic.
  • ๐Ÿšช Coroutine and Loading Curtain
    Mono-based services used for async logic and visual transitions.

Languages

C#87.2%ShaderLab9.2%HLSL1.4%C0.7%C++0.7%CMake0.7%

Contributors

Created March 9, 2025
Updated February 7, 2026
SinlessDevil/ZenjectTemplate | GitHunt