Skip to content

Instantly share code, notes, and snippets.

View OndrejPetrzilka's full-sized avatar

Ondrej Petrzilka OndrejPetrzilka

  • Prague
View GitHub Profile
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
namespace Steamworks
{
static class InterfaceHelper
#if UNITY_ANDROID || UNITY_IOS || UNITY_TIZEN || UNITY_TVOS || UNITY_WEBGL || UNITY_WSA || UNITY_PS4 || UNITY_WII || UNITY_XBOXONE || UNITY_SWITCH
#define DISABLESTEAMWORKS
#endif
#if !DISABLESTEAMWORKS
using System;
using System.Runtime.InteropServices;
using IntPtr = System.IntPtr;
internal static bool Init()
{
HSteamUser hSteamUser = SteamAPI.GetHSteamUser();
HSteamPipe hSteamPipe = SteamAPI.GetHSteamPipe();
if (hSteamPipe == (HSteamPipe)0) { return false; }
using (var pchVersionString = new InteropHelp.UTF8StringHandle(Constants.STEAMCLIENT_INTERFACE_VERSION))
{
m_pSteamClient = NativeMethods.SteamInternal_CreateInterface(pchVersionString);
}