Steamworks.NET icon indicating copy to clipboard operation
Steamworks.NET copied to clipboard

Add setting to prevent Steamworks.NET from injecting define symbols

Open sandolkakos opened this issue 8 months ago • 2 comments

Hi everyone! 👋

I just created a simple settings menu and wanted to share it here in case you're interested in merging it.

When building the game for platforms other than Steam (like Epic Games), we don’t want to include the Steamworks.NET SDK. However, the RedistInstall class keeps automatically adding the STEAMWORKS_NET define symbol to the project, which makes this tricky.

This hasn’t been a big issue in the past, but now that I’m integrating Epic Online Services SDK, I need more flexibility to build for either Steam or Epic. I’m planning to handle that using Unity’s new Build Profiles, which allow me to define platform-specific scripting symbols.

With this new settings option, we can disable the automatic addition of STEAMWORKS_NET, giving us full control per build profile. For example, I can enable the symbol only in my Steam profile, and everything works smoothly. ✅

Let me know what you think!

🔧 How the settings option works

A configuration file is created at:

ProjectSettings/SteamworksNETSettings.json

This file stores the flag value for disabling the automatic STEAMWORKS_NET define symbol. It also serves as a central place to store any other Steamworks.NET-related settings in the future.

  1. The file is created only if you disable the flag at least once
  2. When enabling it again from the disabled state, it will trigger the Domain Reload so the RedistInstall can run and add it automatically again.

This makes it easy to persist and share the configuration across team members and CI setups.

image

sandolkakos avatar Jun 06 '25 05:06 sandolkakos

I love this [and we should have way more settings here!]; though one conflicting 'initiative' we have going is also trying to remove all UnityEngine references. https://github.com/rlabrecque/Steamworks.NET/pull/630 I suspect there's a way to satisfy both of these goals at the same time. Any thoughts?

rlabrecque avatar Jun 07 '25 18:06 rlabrecque

hey @rlabrecque, I'm happy you like it. Because all the changes done here are in the Editor folder, this means it would not conflict with #630, which is removing the UnityEngine reference in the Runtime folder (if I undertood it correctly).

And if we want more settings here, that is totally possible. Something I will probably want to do in future is configure when the App should be a PlayTest, Demo or FullGame. But I still have to think about that, if it will be something for this settings menu or in my own SteamManager, that I created using my singleton system.

sandolkakos avatar Jun 08 '25 02:06 sandolkakos

@rlabrecque it seems like the release was done just before this change was integrated, and this should really be a priority to be integrated - any games that have BOTH a steam and non-steam version will have the scripting defines inserted forcefully, requiring the use of DISABLESTEAMWORKS. is there a plan for a release any time soon? or, ideally, a better schedule for formal releases? having ~a full year of separation between releases means a lot of critical fixes don't make it into a release for a long time

especially because resolution will not handle the versions correctly if you try to install targeting a commit, because the version number isn't being changed at all. bumping the version number, even without a "real" release, would make this significantly easier, rather than having to install the source directly

TheCrossBoy avatar Sep 04 '25 22:09 TheCrossBoy