This package provides a way for registering and managing custom game systems within Unity's player loop. It allows you to create modular and organized updates across different phases of the game loop.
- Define custom game systems that hook into different update phases.
- Use attributes to mark and register custom game systems.
- Automatically integrate custom game systems into Unity's player loop.
- Handles initialization, update, and cleanup of game systems.
To install this package, follow these steps:
- Open your Unity project.
- Go to
Window > Package Manager
. - Click the
+
button and selectAdd package from git URL
. - Enter the URL of this repository and click
Add
.
- Create a new class and implement one or more of the provided interfaces (
IInitialization
,IEarlyUpdate
,IFixedUpdate
,IPostLateUpdate
,IPreLateUpdate
,IPreUpdate
,ITimeUpdate
orIUpdate
). - Mark the class with the
GameSystemAttribute
.
Example:
using UnityEngine;
[GameSystem]
public class MyCustomSystem : IUpdate
{
public void Update()
{
// Custom update logic
}
}
IInitialization
: Initialization phase.IEarlyUpdate
: Early update phase.IFixedUpdate
: Fixed update phase.IPostLateUpdate
: Post-late update phase.IPreLateUpdate
: Pre-late update phase.IPreUpdate
: Pre-update phase.IUpdate
: Regular update phase.
The GameSystemRegister
class handles the registration and integration of custom game systems. It automatically collects, initializes, and adds them to the relevant phases of Unity's player loop.
In the Unity Editor, the player loop is reset to the default state upon exiting play mode to ensure a clean state.
If you encounter any issues or have suggestions for improvements, please open an issue or submit a pull request.
This project is licensed under the MIT License - see the License file for details.
This package was inspired by the need for a modular and organized approach to managing game systems in Unity.