Fallback to FindOrCreateUserInterface if CreateInterface returns null

This commit is contained in:
Garry Newman 2019-05-14 13:29:09 +01:00
parent a2942bd098
commit 98915f0950

View File

@ -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}" );