Skip to content

feat(audience): auto-collect Steam user ID and detect Steam platform#798

Merged
nattb8 merged 1 commit into
mainfrom
feat/sdk-532-steam-user-id
Jun 23, 2026
Merged

feat(audience): auto-collect Steam user ID and detect Steam platform#798
nattb8 merged 1 commit into
mainfrom
feat/sdk-532-steam-user-id

Conversation

@nattb8

@nattb8 nattb8 commented Jun 23, 2026

Copy link
Copy Markdown
Collaborator

What this does

When a game initialises the Audience SDK, it now automatically:

  • Calls Identify with the logged-in Steam user's SteamID64 — only if initial consent is Full
  • Sets distribution_platform = "steam" in the game_launch event properties

No code changes required from the game developer — it just works.

How detection works

The SDK resolves Steamworks types at runtime via C# reflection, so there is no compile-time dependency on any Steamworks library. Games without Steam are completely unaffected.

Four install methods are handled transparently:

Install method Assembly detected
OpenUPM (com.rlabrecque.steamworks.net) com.rlabrecque.steamworks.net
Precompiled .dll plugin Steamworks.NET
Source files in Assets/ Assembly-CSharp
Facepunch.Steamworks DLL Facepunch.Steamworks.Posix/Win64/Win32

All four variants were tested end-to-end against a live Steam session and verified.

Distribution platform override

Auto-detection sets distribution_platform = "steam" only when Steam is active at launch. If the developer explicitly sets config.DistributionPlatform, their value takes precedence — auto-detection runs first, then the config override wins.

A few things worth noting

Consent — Steam Identify only fires when the SDK is initialised with Full consent. If the game starts with Anonymous consent and later upgrades via SetConsent(Full), the auto-identify does not re-run; the developer should call Identify themselves at that point, same as for any other identity source.

Facepunch.SteamworksSteamClient.Init(appId) must be called by the game before the SDK initialises (the SDK cannot call it because the appId is unknown). For Steamworks.NET variants, the SDK calls SteamAPI.Init() itself so it works even if the game hasn't done it yet.

IL2CPP stripping — The SDK uses reflection to reach Steamworks types, which are invisible to the IL2CPP linker. link.xml preservation entries are added for all known Steamworks assembly names; entries for absent assemblies are silently ignored, so non-Steam games are not affected.

No Steam, no impact — If no Steamworks assembly is found the feature is a no-op. Zero overhead on non-Steam platforms.

@nattb8 nattb8 requested review from a team as code owners June 23, 2026 04:04
When Steamworks.NET or Facepunch.Steamworks is present, the SDK now:
- Calls Identify() with the logged-in SteamID64 automatically at Init
- Sets distribution_platform = "steam" in game_launch properties

Detection uses C# reflection so there is no hard compile-time dependency;
games without Steamworks are completely unaffected. All four Steamworks
install methods are supported:
  - UPM via OpenUPM (com.rlabrecque.steamworks.net)
  - Precompiled .dll plugin (assembly name Steamworks.NET)
  - Source files compiled into Assembly-CSharp
  - Facepunch.Steamworks DLL plugin (platform-specific assembly names)

link.xml entries for all Steamworks assemblies ensure IL2CPP does not
strip the types the SDK reaches via reflection. Entries for absent
assemblies are silently ignored, so non-Steam games are unaffected.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@nattb8 nattb8 force-pushed the feat/sdk-532-steam-user-id branch from 0bb49e2 to 71ae613 Compare June 23, 2026 04:21
@nattb8 nattb8 merged commit dc64354 into main Jun 23, 2026
52 of 56 checks passed
@nattb8 nattb8 deleted the feat/sdk-532-steam-user-id branch June 23, 2026 05:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

2 participants