Skip to content

Commit

Permalink
Merge pull request #484 from rlabrecque/add-steamworks-define
Browse files Browse the repository at this point in the history
Added STEAMWORKS_NET define
  • Loading branch information
rlabrecque committed Feb 6, 2022
2 parents a265d4e + 8569c8f commit 69a81da
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion com.rlabrecque.steamworks.net/Editor/RedistInstall.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@
using UnityEngine;
using UnityEditor;
using System.IO;
using System.Collections.Generic;

// This copys various files into their required locations when Unity is launched to make installation a breeze.
[InitializeOnLoad]
public class RedistInstall {
static RedistInstall() {
WriteSteamAppIdTxtFile();

AddDefineSymbols();
CheckForOldDlls();
}

Expand Down Expand Up @@ -54,4 +55,16 @@ static void CheckForOldDlls() {
Debug.LogError("[Steamworks.NET] Please delete the old version of 'steam_api64.dll' in your project root before continuing.");
}
}

static void AddDefineSymbols() {
string currentDefines = PlayerSettings.GetScriptingDefineSymbolsForGroup(EditorUserBuildSettings.selectedBuildTargetGroup);
HashSet<string> defines = new HashSet<string>(currentDefines.Split(';')) {
"STEAMWORKS_NET"
};

string newDefines = string.Join(";", defines);
if (newDefines != currentDefines) {
PlayerSettings.SetScriptingDefineSymbolsForGroup(EditorUserBuildSettings.selectedBuildTargetGroup, newDefines);
}
}
}

0 comments on commit 69a81da

Please sign in to comment.