Skip to content

Sharashino/Unity-Init-Solution

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

InitSolution

A Unity scene management framework implementing the Additive Scene Loading pattern with Service Locator dependency injection for scalable, modular game architecture.

Core Components

Scene Loading

  • SceneLoader: Orchestrates sequential additive scene loading with progress tracking and events
  • SceneLoadConfig: ScriptableObject for configuring bootstrap, persistent, and main scenes
  • PersistentSceneManager: Manages DontDestroyOnLoad objects with lifecycle tracking

Scene Transitions

  • SceneTransitionManager: Runtime scene loading/unloading, reloading, and game reset functionality

Dependency Injection

  • ServiceLocator: Generic service registration and retrieval pattern

Quick Setup

  1. Create scenes: Bootstrap, PersistentSystems, MainScene
  2. Create SceneLoadConfig asset: Assets > Create > InitSolution > Scene Load Config
  3. Configure scene names in the config
  4. Add SceneLoader component to Bootstrap scene
  5. Assign config and set autoStart = true

Usage Patterns

Scene Loading Events

SceneLoader.OnPersistentScenesLoaded += HandlePersistentLoaded;
SceneLoader.OnMainSceneLoaded += HandleMainLoaded;
SceneLoader.OnLoadingProgress += UpdateProgressBar;

Service Registration

ServiceLocator.Register<IAudioService>(audioService);
var audio = ServiceLocator.Get<IAudioService>();

Runtime Transitions

SceneTransitionManager.Instance.LoadSceneAdditive("Level1", setAsActive: true);
SceneTransitionManager.Instance.ResetGame();

Persistent Data

PersistentSceneManager.MarkSceneAsPersistent(scene);
PersistentSceneManager.CleanupAllPersistentObjects();

Events

SceneLoader: OnPersistentScenesLoaded, OnMainSceneLoaded, OnLoadingComplete, OnLoadingProgress

SceneTransitionManager: OnSceneLoadStarted/Completed, OnSceneUnloadStarted/Completed, OnTransitionProgress

ServiceLocator: OnServiceRegistered, OnServicesCleared

Examples

See Examples/ namespace for complete implementations of Bootstrap, GameManager, DataPersistence, SceneTransitions, and ServiceInitializer patterns.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages