Skip to main content

Architecture

Layers

Here's how the dependencies work:

  • Systems layer is the highest-level layer that depends on all other layers - Abstraction, Core, Services, Unity.
  • Unity depends on Abstraction, Core, Services.
  • Services depends on Abstraction and Core.
  • Core only depends on Abstraction.
  • Abstraction is 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

  1. Math Utilities
  2. 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

  1. Dependency Injection
  2. 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

  1. MonoSingleton (Unity's MonoBehaviour)
  2. Unity Injector - injects to Unity GameObjects.

Systems Layer