Throw exception if trying to initialize without destroying old instance

This commit is contained in:
Garry Newman 2017-08-17 12:00:29 +01:00
parent a6b440324b
commit 79f398da04
2 changed files with 10 additions and 0 deletions

View File

@ -65,6 +65,11 @@ public partial class Client : BaseSteamworks
public Client( uint appId )
{
if ( Instance != null )
{
throw new System.Exception( "Only one Facepunch.Steamworks.Client can exist - dispose the old one before trying to create a new one." );
}
Instance = this;
native = new Interop.NativeInterface();

View File

@ -26,6 +26,11 @@ public partial class Server : BaseSteamworks
/// </summary>
public Server( uint appId, ServerInit init )
{
if ( Instance != null )
{
throw new System.Exception( "Only one Facepunch.Steamworks.Server can exist - dispose the old one before trying to create a new one." );
}
Instance = this;
native = new Interop.NativeInterface();