diff --git a/com.rlabrecque.steamworks.net/Editor/RedistInstall.cs b/com.rlabrecque.steamworks.net/Editor/RedistInstall.cs index 141fd47b..4a7fa0e5 100644 --- a/com.rlabrecque.steamworks.net/Editor/RedistInstall.cs +++ b/com.rlabrecque.steamworks.net/Editor/RedistInstall.cs @@ -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(); } @@ -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 defines = new HashSet(currentDefines.Split(';')) { + "STEAMWORKS_NET" + }; + + string newDefines = string.Join(";", defines); + if (newDefines != currentDefines) { + PlayerSettings.SetScriptingDefineSymbolsForGroup(EditorUserBuildSettings.selectedBuildTargetGroup, newDefines); + } + } }