ARTICLE AD BOX
I'm trying to get Steamworks.NET callbacks working inside a Godot C# project, but the callback for the Steam overlay (GameOverlayActivated_t) is never fired.
I reduced the code to the minimum:
using Godot; using Steamworks; public partial class serverTest : Node { protected SteamAPIWarningMessageHook_t m_SteamAPIWarningMessageHook; protected Callback<GameOverlayActivated_t> m_GameOverlayActivated; public override void _EnterTree() { OS.SetEnvironment("SteamAppId", "480"); OS.SetEnvironment("SteamGameId", "480"); bool initialized = SteamAPI.Init(); if (!initialized) { return; } GD.Print("Steam initialized successfully."); if (m_SteamAPIWarningMessageHook == null) { m_SteamAPIWarningMessageHook = new SteamAPIWarningMessageHook_t(SteamAPIDebugTextHook); SteamClient.SetWarningMessageHook(m_SteamAPIWarningMessageHook); } } public override void _Ready() { m_GameOverlayActivated = Callback<GameOverlayActivated_t>.Create(OnGameOverlayActivated); GD.Print("Steam callback for overlay activated set up."); } protected static void SteamAPIDebugTextHook(int nSeverity, System.Text.StringBuilder pchDebugText) { GD.Print($"SteamAPI Debug Message (Severity {nSeverity}): {pchDebugText}"); } public void OnGameOverlayActivated(GameOverlayActivated_t pCallback) { GD.Print($"OnGameOverlayActivated callback triggered! Active: {pCallback.m_bActive}"); } public override void _Process(double delta) { SteamAPI.RunCallbacks(); } }When running the game, I get:
Steam initialized successfully. Steam callback for overlay activated
set up.
But when I open the Steam overlay ingame, the callback is never triggered. There is no log output from OnGameOverlayActivated.
I tried a lots of things but could not trigger any callback that I tried. I don't know what to do anymore... Am I missing an initialization step specific to Godot or Steamworks.NET or do my class need to inherite from another one?
14.5k9 gold badges84 silver badges133 bronze badges
