Files
Project-M/Assets/_Project/Scripts/Simulation/GameBootstrap.cs
T
2026-05-31 14:27:52 -07:00

28 lines
1.1 KiB
C#

using Unity.Entities;
using Unity.NetCode;
using UnityEngine.Scripting;
namespace ProjectM.Simulation
{
/// <summary>
/// Custom Netcode for Entities bootstrap. Subclassing <see cref="ClientServerBootstrap"/>
/// gives an explicit hook to customize world creation, tick rate, and auto-connect.
/// For now it reproduces the default behavior: create separate client and server worlds
/// based on the Multiplayer PlayMode Tools settings, without auto-connecting.
/// </summary>
[Preserve]
public class GameBootstrap : ClientServerBootstrap
{
public override bool Initialize(string defaultWorldName)
{
// Auto-connect in-editor: the server listens and the in-process client connects (over
// IPC) on the default BinaryWorlds host mode — one process hosts both worlds (M1 listen
// server). M3 replaces this with an explicit Unity Relay host/join flow. Set to 0 to
// disable auto-connect.
AutoConnectPort = 7979;
CreateDefaultClientServerWorlds();
return true;
}
}
}