Example #1
0
 public static void TestIfAvailableClient()
 {
     TestIfPlatformSupported();
     if (CSteamAPIContext.GetSteamClient() == System.IntPtr.Zero)
     {
         if (!CSteamAPIContext.Init())
         {
             throw new System.InvalidOperationException("Steamworks is not initialized.");
         }
     }
 }
Example #2
0
		//----------------------------------------------------------------------------------------------------------------------------------------------------------//
		//	Steam API setup & shutdown
		//
		//	These functions manage loading, initializing and shutdown of the steamclient.dll
		//
		//----------------------------------------------------------------------------------------------------------------------------------------------------------//


		// SteamAPI_Init must be called before using any other API functions. If it fails, an
		// error message will be output to the debugger (or stderr) with further information.
		public static bool Init() {
			InteropHelp.TestIfPlatformSupported();

			bool ret = NativeMethods.SteamAPI_Init();

			// Steamworks.NET specific: We initialize the SteamAPI Context like this for now, but we need to do it
			// every time that Unity reloads binaries, so we also check if the pointers are available and initialized
			// before each call to any interface functions. That is in InteropHelp.cs
			if (ret)
			{
				ret = CSteamAPIContext.Init();
			}

			return ret;
		}