StreamerManager
A class in Root.Township, the global namespace.
Singleton (Instance) that loads and unloads chunk prefabs within a per-frame time budget and saves the world, including the server's timed auto save.
- Listed in Global namespace: S
- Inherits or implements
MonoBehaviour
Constructors
| Member | What it is |
|---|---|
StreamerManager() | Unity makes components itself; use AddComponent or spawn a prefab instead of new. |
Fields
| Member | What it is |
|---|---|
static StreamerManager Instance | The active manager; a second copy destroys itself. |
6 private and internal fields
Properties
| Member | What it is |
|---|---|
static List<IAutoSave> AutoSavingBehaviours { get; } | Objects whose AutoSave runs after the chunks are saved, such as GameTaskManager and PerPlayerManager. |
float StreamingTimeAllowanceMilliseconds { get; } | Per-frame time budget in milliseconds for chunk streaming and spread-out saving. |
Methods
| Member | What it is |
|---|---|
async Task SaveWorld(bool isInstant) | Saves every chunk, the auto save behaviours and all players, then flushes files and backs up changed remote files. An instant save blocks and cancels a running one. |
void StartAutoSave() | Server: starts the auto save loop if the server config turns auto saving on. Called by ServerHandler. |
5 private and internal methods
| Member | What it is |
|---|---|
private async void AutoSave() | Server: loop that waits the configured minutes and saves the world, skipping while a wipe or another save is running. |
private void OnDestroy() | Stops the auto save loop. |
private void OnEnable() | Sets Instance, or destroys this copy if one already exists. |
private async Task SaveWorld(bool isInstant, CancellationToken cancellationToken) | Saves every chunk, the auto save behaviours and all players, then flushes files and backs up changed remote files. An instant save blocks and cancels a running one. |
private void Update() | Loads and unloads chunk prefabs within the time budget. |