Skip to content

Latest commit

 

History

History
67 lines (53 loc) · 1.67 KB

Getting-Started.md

File metadata and controls

67 lines (53 loc) · 1.67 KB

GodotSteam C# Bindings

Back to README

Table of Contents

Installation

  1. Make sure you have set up GodotSteam GDExtension. You can get it either from the GitHub Releases or the Godot AssetLib.
  2. Copy the /addons/godotsteam_csharpbindings folder into your project. Alternatively, you can download "GodotSteam C# Bindings" from the Godot AssetLib or just drop in the latest GitHub Release.
  3. Now build your C# solution in JetBrains Rider.

Getting Started

Once everything is set up properly, you can test C# Bindings with this initial example script:

using Godot;
using GodotSteam;

public partial class SteamDemo : Node
{
	private const uint AppId = 480;

	public override void _EnterTree()
	{
		OS.SetEnvironment("SteamAppId", AppId.ToString());
		OS.SetEnvironment("SteamGameId", AppId.ToString());
	}

	public override void _Ready()
	{
		Steam.SteamInit();

		var isSteamRunning = Steam.IsSteamRunning();
		if (!isSteamRunning)
		{
			GD.Print("Steam is not running.");
			return;
		}
		
		var steamId = Steam.GetSteamID();
		var name = Steam.GetFriendPersonaName(steamId);	
        
		GD.Print("Your Steam Name: " + name);
	}
}

Signals / Events

This project aims to create a familiar developer experience for C# developers. Thus, GDScript signals emitted from GodotSteam are available as events which can be subscribed to.

Steam.SteamworksError += (failedSignal, iOFailure) =>
{
    GD.PrintErr(failedSignal);
    GD.PrintErr(iOFailure);
};
Steam.AvatarLoaded += (id, size, data) =>
{
    // Use id/size/data
};