Skip to content

Instantly share code, notes, and snippets.

@Elideb
Elideb / ChangePCStore.cs
Last active September 26, 2021 11:23
Generating builds from scripts in Unity
#if UNITY_STANDALONE && !STEAM_BUILD
[MenuItem("Build/Switch to Steam")]
#endif
public static void SwitchToSteam() {
string defines = PlayerSettings.GetScriptingDefineSymbolsForGroup(BuildTargetGroup.Standalone);
defines = AddCompilerDefines(defines, "STEAM_BUILD");
defines = RemoveCompilerDefines(defines, "GOG_BUILD");
UnityEngine.Debug.Log("Compiling with DEFINE: '" + defines + "'");
PlayerSettings.SetScriptingDefineSymbolsForGroup(BuildTargetGroup.Standalone, defines);