Troubleshooting Guide¶
Common issues and solutions for LoLEngine.
Table of Contents¶
- Installation Issues
- Service Initialization
- Save System
- Audio System
- Resource Management
- Performance Issues
- Build Errors
Installation Issues¶
Compilation Errors After Import¶
Problem: Console shows compilation errors after importing LoLEngine
Solutions:
1. Wait for Unity to finish importing all assets
2. Check Unity version compatibility (6000.0 or newer required)
3. Install required packages:
- Input System: Window → Package Manager → Input System
- TextMeshPro (should be included by default)
4. Reimport LoLEngine: Right-click folder → Reimport
5. Restart Unity Editor
Missing Dependencies¶
Problem: "Type or namespace not found" errors
Solutions: 1. Install Unity Input System package 2. If using Addressables, install Addressables package 3. Check that all LoLEngine folders are present:
Assets/LoLEngine/
├── Runtime/
├── Editor/
└── Documentation~/
Service Initialization¶
Services Not Initializing¶
Problem: "Service not found" errors or null references
Solutions:
-
Check ServiceConfiguration exists and is assigned:
// In ImprovedGameInitializer Inspector Service Configuration: [Must be assigned] -
Verify services are enabled:
- Open ServiceConfiguration asset
-
Check required services are enabled:
- [x] Enable Event Manager
- [x] Enable Resource Service
- etc.
-
Check initialization order:
// Wait for services before using them void Start() { if (ServiceAwaiter.AreServicesReady()) OnServicesReady(); else ServiceAwaiter.WaitForServices(this, OnServicesReady, OnServicesTimeout); } -
Verify ImprovedGameInitializer is in first scene:
- Check Build Settings → Scene 0 contains GameInitializer
-
Ensure only ONE GameInitializer exists
-
Check console for initialization errors:
- Look for red errors during startup
- Check service dependency warnings
Service Timeout Errors¶
Problem: "Timed out waiting for services" message
Solutions:
- Check for service initialization errors:
- Look for errors before timeout message
-
Fix any service-specific errors first
-
Verify service dependencies:
Required dependencies: - SaveSystem → SerializationService - MusicPlaylistService → AudioService -
Increase timeout if needed (rare):
ServiceAwaiter.WaitForServices(this, OnReady, OnTimeout, timeoutSeconds: 10f); -
Check ServiceConfiguration is valid:
- Not null
- All referenced configs exist
- No circular dependencies
Save System¶
Save Files Not Creating¶
Problem: SaveGame() doesn't create files
Solutions:
- Check Save System is enabled:
- ServiceConfiguration → [x] Enable Data Persistence Service
-
ServiceConfiguration → [x] Enable Serialization Service
-
Verify save path has write permissions:
Debug.Log(Application.persistentDataPath); // Check this path -
Check for save errors in console
-
Verify SaveConfig is assigned:
// In ServiceConfiguration Save Config: [Must be assigned] -
Test with simple save:
var saveSystem = ServiceLocator.Instance.Get<ISaveSystem>(); saveSystem.SaveGame("test_save");
Load Fails¶
Problem: LoadGame() returns false or fails
Solutions:
-
Check if save file exists:
if (saveSystem.HasSaveFile("save1")) { saveSystem.LoadGame("save1"); } else { Debug.LogWarning("Save file doesn't exist"); } -
Check file extension matches configuration:
- Default:
.savfor unencrypted -
Encrypted:
.esave -
Verify encryption/compression settings match:
- Can't load encrypted save without encryption enabled
-
Can't load compressed save without compression enabled
-
Check save version compatibility:
- Older save files may be incompatible with new code
- Increment save version when making breaking changes
Encryption Errors¶
Problem: "Failed to encrypt/decrypt" errors
Solutions:
- Ensure EncryptionService is enabled:
-
ServiceConfiguration → [x] Enable Encryption Service
-
Check encryption key is set in LoLEngineConfig:
Encryption Settings: ├─ Use Encryption: true └─ Encryption Key Seed: [Must be set] -
Never commit encryption keys to source control:
- Use environment variables for production keys
-
Keep development keys separate
-
Encryption key must be consistent:
- Same key for save and load
- Changing key makes old saves unreadable
Audio System¶
Audio Not Playing¶
Problem: PlaySound() doesn't produce audio
Solutions:
- Check AudioService is enabled:
-
ServiceConfiguration → [x] Enable Audio Service
-
Verify AudioConfig is assigned and configured:
Audio Config: ├─ Tracks: [Must have at least one track] ├─ Master Volume: > 0 └─ Default Volume: > 0 -
Check audio clip path is correct:
// For Resources audioService.PlaySound("Audio/UIClick"); // Must exist at Resources/Audio/UIClick // For Addressables // Asset must be marked as Addressable with matching address -
Verify AudioListener exists in scene:
- Usually on Main Camera
-
Only ONE AudioListener should exist
-
Check track volume and mute status:
var track = audioService.GetTrack("Music"); Debug.Log($"Track volume: {track.Volume}, Muted: {track.Muted}"); -
Test with simple audio:
this.PlaySound("test_audio_clip");
Audio Pops or Clicks¶
Problem: Audio has pops, clicks, or glitches
Solutions:
-
Enable object pooling for AudioSources:
Audio Config: └─ Use Object Pooling: true -
Increase pool size:
Pool Settings: ├─ Initial Pool Size: 20 └─ Max Pool Size: 50 -
Preload frequently used audio:
await AudioPreloadManager.Instance.PreloadAudioAsync("audioId"); -
Check audio clip import settings:
- Load Type: Streaming (for music)
- Load Type: Decompress On Load (for SFX)
- Compression Format: Vorbis or ADPCM
Resource Management¶
Asset Not Loading¶
Problem: LoadAsync
Solutions:
- For Addressables:
- Verify asset is marked as Addressable
- Check address/key matches exactly
-
Build Addressables:
Window → Asset Management → Addressables → Build → New Build → Default Build Script -
For Resources:
- Asset must be in
Resourcesfolder - Path relative to Resources folder (no extension)
-
Example:
Resources/Audio/Music.mp3→"Audio/Music" -
Check ResourceService is enabled:
-
ServiceConfiguration → [x] Enable Resource Service
-
Verify asset type matches:
// Must match actual asset type var clip = await resourceService.LoadAsync<AudioClip>("Audio/Music"); // Not Texture2D if it's an AudioClip! -
Check console for load errors
Performance Issues¶
Low FPS¶
Solutions:
- Check object pooling is enabled:
- ServiceConfiguration → [x] Enable Object Pool
-
Use pooling for frequently spawned objects
-
Optimize save frequency:
- Reduce auto-save frequency
-
Enable compression
-
Disable debug logging in builds:
LoLLogger.LOGEnabled = false; // In production -
Profile with Unity Profiler:
Window → Analysis → Profiler- Check for CPU/memory spikes
Memory Leaks¶
Solutions:
-
Release loaded resources:
void OnDestroy() { resourceService.Release("asset_path"); } -
Unsubscribe from events:
void OnDisable() { this.EventStopListening<MyEvent>(); } -
Return pooled objects:
this.Despawn(gameObject); // Don't Destroy() pooled objects
Build Errors¶
"Type or Namespace Not Found" in Build¶
Problem: Builds fail with type errors (editor works fine)
Solutions:
- Check all required packages are installed
-
Verify no Editor-only code in Runtime scripts:
#if UNITY_EDITOR // Editor-only code here #endif -
Check platform-specific code is guarded:
#if UNITY_ADDRESSABLES // Addressables code #endif
Addressables Build Fails¶
Solutions:
- Build Addressables before player build:
-
Window → Asset Management → Addressables → Build → New Build → Default Build Script -
Clean Addressables cache:
Addressables → Build → Clean Build → All-
Then rebuild
-
Check for invalid references
Getting More Help¶
If your issue isn't covered here:
- Check console for errors - Most issues log helpful error messages
- Review relevant documentation - Check specific system docs
- Check samples - LoLEngine includes working examples
-
Enable verbose logging:
LoLLogger.LOGLevel = LogLevel.Debug; -
Create minimal reproduction:
- New scene
- Minimal setup
- Test specific feature
Quick Diagnostics Checklist¶
When experiencing issues, check:
- [ ] ServiceConfiguration exists and is assigned to GameInitializer
- [ ] Required services are enabled in ServiceConfiguration
- [ ] Console has no errors
- [ ] GameInitializer is in first scene (Scene 0 in Build Settings)
- [ ] Only one GameInitializer exists
- [ ] Using ServiceAwaiter to wait for services
- [ ] All required Unity packages installed
- [ ] Asset paths are correct
- [ ] No circular service dependencies
See Also¶
- Getting Started - Initial setup guide
- CHEATSHEET - Quick reference
- Service Dependencies - Service requirements