-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathECSPowerNetcodeModule.cs
42 lines (36 loc) · 1.16 KB
/
ECSPowerNetcodeModule.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
using Plugins.ECSPowerNetcode.Archetypes;
using Plugins.ECSPowerNetcode.Client;
using Plugins.ECSPowerNetcode.Server;
using Plugins.ECSPowerNetcode.Worlds;
using Unity.Collections;
using Unity.Entities;
using UnityEngine;
using UnityEngine.LowLevel;
namespace Plugins.ECSPowerNetcode
{
public static class ECSPowerNetcodeModule
{
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.SubsystemRegistration)]
public static void Clean()
{
// clean module
NetcodeEntityArchetypeManager.Reset();
EntityWorldManager.Reset();
ClientManager.Reset();
ServerManager.Reset();
}
public static void Shutdown()
{
// shutdown ECS
var playerLoop = PlayerLoop.GetCurrentPlayerLoop();
foreach (var w in World.All)
ScriptBehaviourUpdateOrder.RemoveWorldFromPlayerLoop(w, ref playerLoop);
PlayerLoop.SetPlayerLoop(playerLoop);
World.DisposeAllWorlds();
WordStorage.Instance.Dispose();
WordStorage.Instance = null;
// clean module
Clean();
}
}
}