forked from Unity-Technologies/EntityComponentSystemSamples
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathServerEntryPoint.cs
More file actions
41 lines (37 loc) · 1.21 KB
/
Copy pathServerEntryPoint.cs
File metadata and controls
41 lines (37 loc) · 1.21 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
40
41
#if UNITY_DOTSRUNTIME
using Unity.Platforms;
using Unity.Runtime;
using Unity.Runtime.EntryPoint;
using Unity.Logging;
namespace DOTSRuntime.Server
{
public class ServerMain
{
public static void Main()
{
Program.Initialize();
var unity = UnityInstance.Initialize();
TempMemoryScope.EnterScope();
Unity.Logging.DefaultSettings.Initialize();
Log.Info("Logging initialized...");
TempMemoryScope.ExitScope();
unity.OnTick = (double timestampInSeconds) =>
{
UnityInstance.UpdatePreFrame();
Unity.Logging.DefaultSettings.UpdateFunction();
var shouldContinue = unity.Update(timestampInSeconds);
UnityInstance.UpdatePostFrame(shouldContinue);
return shouldContinue;
};
PlatformEvents.OnQuit += (sender, evt) =>
{
Log.Info("Application is shutting down...");
unity.Deinitialize();
Unity.Logging.Internal.LoggerManager.FlushAll();
Program.Shutdown();
};
RunLoop.EnterMainLoop(unity.OnTick);
}
}
}
#endif