-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathBootstrap.cs
More file actions
39 lines (31 loc) · 1.25 KB
/
Bootstrap.cs
File metadata and controls
39 lines (31 loc) · 1.25 KB
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
using Plugins.ECSPowerNetcode.Worlds;
using Unity.Entities;
using Unity.NetCode;
using UnityEngine.LowLevel;
namespace Plugins.ECSPowerNetcode
{
public class Bootstrap : ClientServerBootstrap
{
public override bool Initialize(string defaultWorldName)
{
Initialize(true, true);
return true;
}
public void Initialize(bool createClientWorld, bool createServerWorld)
{
var systems = DefaultWorldInitialization.GetAllSystems(WorldSystemFilterFlags.Default);
GenerateSystemLists(systems);
var world = new World("DefaultWorld");
World.DefaultGameObjectInjectionWorld = world;
DefaultWorldInitialization.AddSystemsToRootLevelSystemGroups(world, ExplicitDefaultWorldSystems);
var currentPlayerLoop = PlayerLoop.GetCurrentPlayerLoop();
ScriptBehaviourUpdateOrder.AddWorldToPlayerLoop(world, ref currentPlayerLoop);
PlayerLoop.SetPlayerLoop(currentPlayerLoop);
if (createClientWorld)
CreateClientWorld(world, "ClientWorld");
if (createServerWorld)
CreateServerWorld(world, "ServerWorld");
EntityWorldManager.Instance.Initialize();
}
}
}