Steamworks.NET

repository·master·Indexed 25 days ago

https://github.com/rlabrecque/steamworks.net

A C# wrapper for Valve's Steamworks API, enabling the integration of Steam features into Unity projects or standalone C# applications. It supports Windows (32 and 64 bit), OSX, and Linux, and is designed to remain close to the original C++ API. Version 2025.163.0 builds against Steamworks SDK 1.65.

Tokens
863
Snippets
0
Records
7
Agent score
85%

What's inside Steamworks.NET

  1. Overview of Steamworks.NET

    master

    Steamworks.NET is a C# wrapper for Valve's Steamworks API. It is designed to be used with Unity or any C# based application. The wrapper aims to stay as close as possible to the original C++ API, meaning that Valve's official Steamworks documentation is largely applicable to this library.

    Supported Platforms:

    • Windows (32 and 64 bit)
    • OSX
    • Linux

    Note: The current version builds against Steamworks SDK 1.65.

  2. Generate Steamworks.NET C# bindings using CodeGen

    master

    Steamworks.NET CodeGen is a tool that generates the autogen/ and types/ directories by parsing Steamworks C++ header files and converting them to C#. It relies on SteamworksParser for the parsing logic.

    To generate the bindings, follow these steps:

    1. Update the files in the steam/ directory if necessary.
    2. Open a command prompt and navigate to the CodeGen directory. Note: The script must be executed from this specific directory to ensure relative paths function correctly.
    3. Run the Python script using python3 Steamworks.NET_CodeGen.py.

    Recommendation: It is preferred to run this on a Linux-based OS (such as WSL) to ensure proper line endings are generated.

  3. Explore Steamworks.NET Samples

    master

    To understand how to implement the API, you can review the following sample projects:

    • Steamworks.NET Example: General usage examples.
    • Steamworks.NET Test: Testing implementation.
    • Steamworks.NET ChatClient: Implementation of Steam chat features.
    • Steamworks.NET GameServerTest: Implementation of Steam game server features.
  4. Install Steamworks.NET for non-Unity applications

    master

    To use Steamworks.NET in a standalone (non-Unity) C# application, follow one of these two routes:

    1. Download prebuilt binaries from the Releases page or build the standalone assemblies using the project file in Standalone/ via Visual Studio.
    2. Reference the built assembly Steamworks.NET.dll in your project.
    3. Call SteamAPI.Init() in your code before initializing your renderer.
    1. Copy Plugins/Steamworks.NET directly into your C# project.
    2. In Visual Studio, open your project properties, navigate to the Build tab, and define STEAMWORKS_WIN or STEAMWORKS_LIN_OSX globally via Conditional compilation symbols.
    3. Note: This route is only recommended if your binary is not intended to be portable across platforms. If shipping on multiple platforms, use Route A.
  5. Configure required deployment files for Steamworks.NET

    master

    When building your application, you must ensure the following files are copied into your output directory for the application to run correctly:

    All Platforms

    • steam_appid.txt: Required for testing your application outside of Steam. Do not ship this to customers!
    • Steamworks.NET.dll: Ensure you use the correct version for your target platform. (Note: When building for OSX or Linux, the wrong version may be copied by default; use a post-build script to ensure the correct one is used).

    Windows

    • steam_api.dll

    OSX

    • steam_api.bundle
    • Steamworks.NET.dll.config: Required for Mono to locate CSteamworks.

    Linux

    • libsteam_api.so