Initial import
This commit is contained in:
23
Assets/Scripts/NetCode/GameBootstrap.cs
Normal file
23
Assets/Scripts/NetCode/GameBootstrap.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
using System.Collections.Generic;
|
||||
using Unity.NetCode;
|
||||
|
||||
namespace EE2Clone.NetCode
|
||||
{
|
||||
/// <summary>
|
||||
/// Custom bootstrap that prevents automatic world creation.
|
||||
/// We manually create client/server worlds when the player chooses to host or connect.
|
||||
/// </summary>
|
||||
[UnityEngine.Scripting.Preserve]
|
||||
public class GameBootstrap : ClientServerBootstrap
|
||||
{
|
||||
public override bool Initialize(string defaultWorldName)
|
||||
{
|
||||
// Create only the default (local) world on startup.
|
||||
// Client and server worlds are created manually when the user
|
||||
// starts hosting or joins a game.
|
||||
AutoConnectPort = 0;
|
||||
CreateDefaultClientServerWorlds();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user