UniTime
UniTime provides a testable time integration system for Unity, enabling precise control over game time without coupling to Unity's built-in Time class. Manipulate time flow, create timers and stopwatches, and trigger time-based events while maintaining full testability through dependency injection and abstraction layers.
com.chikacc.unitime 
Install via UPM
Add to Unity Package Manager using this URL
https://www.pkglnk.dev/unitime.git?path=src/UniTime/Assets/Plugins/UniTime README Markdown
Copy this to your project's README.md
## Installation
Add **UniTime** to your Unity project via Package Manager:
1. Open **Window > Package Manager**
2. Click **+** > **Add package from git URL**
3. Enter:
```
https://www.pkglnk.dev/unitime.git?path=src%2FUniTime%2FAssets%2FPlugins%2FUniTime
```
[](https://www.pkglnk.dev/pkg/unitime)README
UniTime
Provides a testable time integration for Unity.
Overview
The UniTime Package provides a testable time integration solution for Unity, allowing developers to easily manipulate and control time within their projects. With UniTime, you can pause, slow down, or speed up time, as well as create custom time events and triggers. This package is perfect for games that require advanced time management, such as simulations, strategy games, or puzzle games.
Gettings Started
Install via UPM package or asset package(UniTime...*.unitypackage) available in UniTime/releases page.
using UniTime;
async Task Demo() {
var timeProvider = new UniTimeProvider();
Debug.Log("Current time: " + timeProvider.Time);
var stopwatch = new DoubleBasedUniTimeStopwatch(timeProvider);
stopwatch.Start();
var ticker = new GameObject().AddComponent<CoroutineUniTimeTicker>();
ticker.Tick += () => Debug.Log($"Ticker tick: {timeProvider.Time}");
var timer = new DoubleBasedUniTimeTimer(timeProvider, ticker);
timer.Interval = 5000; // 5 seconds
timer.AutoReset = true;
timer.Elapsed += (sender, e) => Debug.Log($"Timer elapsed: {stopwatch.Elapsed}");
timer.Enabled = true;
await Task.Delay(TimeSpan.FromSeconds(15));
stopwatch.Stop();
Debug.Log("Stopwatch elapsed: " + stopwatch.Elapsed);
}
License
This library is licensed under the MIT License.
Logo icon made by verry purnomo from Flaticon. Logo Font made by SourceSansPro from Adobe Systems Incorporated.
No comments yet. Be the first!