Facepunch.Steamworks Wiki

Installing For Unity

File Placement

Grab the latest version from the Release Page. Download the Facepunch.Steamworks file - not the source.

Inside there's a Unity folder. Extract that to your project folder.

Unity Config

We have included the Unity .meta files in the zip file, so everything should be set up. The dlls should be assigned to the right platforms and should copy the dlls to the right locations on build.

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 - it's one of these: // // Steam is closed? // Can't find steam_api dll? // Don't have permission to play app? // }
You should only call this once on startup. Structure your code so this happens in your initialization code.

Running

Every frame or so you should call RunCallbacks. This allows Steam to think and run any callbacks that are waiting.

void Update() { Steamworks.SteamClient.RunCallbacks(); }

Shutting Down

When you're done call SteamClient.Shutdown.

Steamworks.SteamClient.Shutdown();
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.

Page Links


Special Pages


Wikis

?

Render Time: 15ms

Session 0
DB GetPage 2
Generate Html 1
SaveChanges 8
Render Body 0
Render Sidebar 1