Files
sbox-public/engine/Sandbox.Engine/Systems/Networking/System/NetworkSystem.Game.cs
Lorenz Junglas ca923d7a86 Unblock main thread during load (#4725)
* Async version of LoadAllGameResources

Can't move this off the main thread but we can time slice it so it's not blocking for a longer duration.

* Time slice Package.Download too

* Add a bunch of yields when compiling packages

* Add more loading screen titles and subtitles
2026-05-05 13:36:57 +01:00

35 lines
819 B
C#

using Sandbox.Engine;
namespace Sandbox.Network;
internal partial class NetworkSystem
{
internal GameNetworkSystem GameSystem { get; set; }
public void InitializeGameSystem()
{
// If we are unit testing we dont want to do any of this for now, this only works with a gamepackage loaded
if ( IGameInstanceDll.Current is null || Application.IsUnitTest )
return;
GameSystem = IGameInstanceDll.Current.CreateGameNetworking( this );
GameSystem?.OnInitialize();
if ( GameSystem is null )
Disconnect();
}
public async Task InitializeGameSystemAsync()
{
if ( IGameInstanceDll.Current is null || Application.IsUnitTest )
return;
GameSystem = await IGameInstanceDll.Current.CreateGameNetworkingAsync( this );
GameSystem?.OnInitialize();
if ( GameSystem is null )
Disconnect();
}
}