Architecture
Layers
Here's how the dependencies work:
Systemslayer is the highest-level layer that depends on all other layers -Abstraction,Core,Services,Unity.Unitydepends onAbstraction,Core,Services.Servicesdepends onAbstractionandCore.Coreonly depends onAbstraction.Abstractionis the lowest-level layer.
Abstraction Layer
This layer holds no-logic classes, interfaces and enums. There should never be any logic here. Examples are:
public interface IGlacierEvent {}
public interface IGlacierLogger {}
public enum GlacierLogType {}
This layer is what allows Core layer to utilize higher ones i.e. Services and Systems.
Core Layer
This layer, similar to Services, should only use plain C# .NET logic - no Unity-specific logic. If you have services that needs to utilize Unity-specific features, use Unity layer.
Some features
- Math Utilities
- Singleton (C# .NET only)
Services Layer
This layer, similar to Core, should only use plain C# .NET logic - no Unity-specific logic. If you have services that needs to utilize Unity-specific features, use Unity layer.
Some features
- Dependency Injection
- Logger
Unity Layer
This layer holds some classes that either should be in Core or Services but needs Unity-specific features. This makes Core and Services pure C# .NET codes and can easily be unit-tested. Examples are:
public abstract class GlacierMonoSingleton<>
public static class GlacierUnityInjector
Some features
- MonoSingleton (Unity's MonoBehaviour)
- Unity Injector - injects to Unity GameObjects.