Skip to main content

GameServiceFactory

Central utility for constructing and caching core gameplay services. Designed to encapsulate common service initialization logic and ensure singleton-style access across systems that require UI, audio, resource, or orchestration components.

public class GameServiceFactory

Purpose​

  • Centralized initialization of major systems (GameOrchestrator, UIInstanceManager, etc.)
  • Ensures all services are cached and reused
  • Serves as a backbone for systems relying on runtime provisioning and dependency injection

Initialization​

void Initialize()

Should be called once at startup to bootstrap core services such as:

  • GlobalAddressableManager
  • UIInstanceManager
  • GameOrchestrator
  • DeviceStatusService

Getters​

GetGameOrchestrator()​

Returns the orchestrator instance, initializing it and setting the environment if null.
➡ Uses public for RELEASE_CANDIDATE, development otherwise.

GetUIInstanceManager()​

Returns a UI manager for spawning/controlling UI elements. Sets its factory context.

GetGlobalAddressableManager()​

Handles Unity Addressables lifecycle and setup.

GetResourceFactory()​

Provides asset creation/management tools.

GetDeviceStatusService()​

Provides access to hardware-level state (connectivity, battery, rotation, input device changes, etc.)

GetMobileMultitouchService()​

Provides touch input abstraction for mobile devices.

GetStreamingAudioProvider()​

Provides runtime access to audio streaming controls or assets.


Integration Tip​

This factory is usually injected into core systems like GameStateManager to decouple direct instantiation logic.

[Inject]
private GameServiceFactory _factory;

var orchestrator = _factory.GetGameOrchestrator();