From 98915f0950fb268f1a3c6afa4e55e1f24c41b80f Mon Sep 17 00:00:00 2001 From: Garry Newman Date: Tue, 14 May 2019 13:29:09 +0100 Subject: [PATCH] Fallback to FindOrCreateUserInterface if CreateInterface returns null --- Facepunch.Steamworks/Utility/SteamInterface.cs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Facepunch.Steamworks/Utility/SteamInterface.cs b/Facepunch.Steamworks/Utility/SteamInterface.cs index 4ad4003..550aa24 100644 --- a/Facepunch.Steamworks/Utility/SteamInterface.cs +++ b/Facepunch.Steamworks/Utility/SteamInterface.cs @@ -47,12 +47,18 @@ namespace Steamworks // CreateInterface doesn't seem to have caused any fires, so we'll just use that. // - // var user = SteamAPI.GetHSteamUser(); + // // var pipe = SteamAPI.GetHSteamPipe(); - // Self = SteamInternal.FindOrCreateUserInterface( user, InterfaceName ); + // Self = SteamInternal.CreateInterface( InterfaceName ); + if ( Self == IntPtr.Zero ) + { + var user = SteamAPI.GetHSteamUser(); + Self = SteamInternal.FindOrCreateUserInterface( user, InterfaceName ); + } + if ( Self == IntPtr.Zero ) throw new System.Exception( $"Couldn't find interface {InterfaceName}" );