Facepunch.Steamworks 2.0.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package Facepunch.Steamworks --version 2.0.0                
NuGet\Install-Package Facepunch.Steamworks -Version 2.0.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Facepunch.Steamworks" Version="2.0.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Facepunch.Steamworks --version 2.0.0                
#r "nuget: Facepunch.Steamworks, 2.0.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Facepunch.Steamworks as a Cake Addin
#addin nuget:?package=Facepunch.Steamworks&version=2.0.0

// Install Facepunch.Steamworks as a Cake Tool
#tool nuget:?package=Facepunch.Steamworks&version=2.0.0                

If you're making a game you probably want the SteamClient. This gives access to things like friends, achievements, stats, server lists etc.

Dlls

You need to copy us to your project to be able to use Steamworks.

Regular .net app

You'll need to put steam_api64.dll somewhere - and make sure you're building as 64bit.

Unity

If you're using Unity, open the release zip file and copy the Unity file into your project, anywhere in Assets (we usually put it in Assets/Plugins/Facepunch.Steamworks/.

The zip file already includes .meta files so that files the dlls are set up properly. The .meta files for the native dlls are set up in a way that mean that they're used on the right platforms and will get copied properly on build. You don't need to do anything special.

Initializing

To start up you just call Steamworks.SteamClient.Init with your appid. If it can't initialize it'll throw an exception - so make sure you catch that and deal with it.

try
{
	Steamworks.SteamClient.Init( 252490 );
}
catch ( System.Exception e )
{
	// Something went wrong! Steam is closed?
}

Common reasons for exceptions are:

  • Steam is closed
  • Can't find steam_api dlls
  • Don't have permission to open appid

In Unity I'd recommend calling this in an Awake on an object with DontDestroyOnLoad called on it.

Running

Every frame or so you should call RunCallbacks.

Steamworks.SteamClient.RunCallbacks();

In Unity I'd recommend sticking it in an Update.

Using

You can make sure Steam is loaded and accessible using SteamClient.IsValid.

Here's some examples of other interfaces and functions to give you an idea of how to use/find stuff.

var playername = SteamClient.Name;
var playersteamid = SteamClient.SteamId;

SteamScreenshots.TriggerScreenshot();

Steamworks.SteamUserStats.SetStat( "deaths", value );

foreach ( var item in Steamworks.SteamInventory.Items )
{
	Debug.Log( $"{item.Def.Name} x {item.Quantity}" );
}

foreach ( var player in SteamFriends.GetFriends() )
{
	Debug.Log( $"{player.Name}" );
}

Shutting Down

When you're done call SteamClient.Shutdown.

Steamworks.SteamClient.Shutdown();

A word of warning: Steam won't actually show that you've stopped playing the game at this point. It doesn't do that until the exe and any child processes are closed. It sucks, but that's the way it is.

This also means that in the Unity Editor it'll show as in game until you close the editor, but subsequent SteamClient.Init calls are needed and will work.

In Unity I'd recommend sticking it in an OnDisable, so that it gets called every time you stop playing.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net46 is compatible.  net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETFramework 4.6

    • No dependencies.
  • .NETStandard 2.0

    • No dependencies.

NuGet packages (4)

Showing the top 4 NuGet packages that depend on Facepunch.Steamworks:

Package Downloads
Facepunch.Steamworks.Library

Ships Steam redistributables necessary for Facepunch.Steamworks

BetterUI

Package Description

Packety

Package Description

LANCommander.SDK

A .NET library for interacting with a LANCommander server

GitHub repositories (2)

Showing the top 2 popular GitHub repositories that depend on Facepunch.Steamworks:

Repository Stars
LorisYounger/VPet
虚拟桌宠模拟器 一个开源的桌宠软件, 可以内置到任何WPF应用程序
egordorichev/BurningKnight
Top-down roguelike about goblins, lamps and magic
Version Downloads Last updated
2.3.3 37,424 2/28/2020
2.3.1 587 2/25/2020
2.3.0 694 2/24/2020
2.2.0 1,453 8/29/2019
2.1.0 1,119 6/21/2019
2.0.0 671 5/30/2019
0.7.5 4,547 3/21/2018