diff --git a/com.rlabrecque.steamworks.net/Editor/RedistCopy.cs b/com.rlabrecque.steamworks.net/Editor/RedistCopy.cs index 7408b930..1d89caea 100644 --- a/com.rlabrecque.steamworks.net/Editor/RedistCopy.cs +++ b/com.rlabrecque.steamworks.net/Editor/RedistCopy.cs @@ -25,6 +25,8 @@ public static void OnPostprocessBuild(BuildTarget target, string pathToBuiltProj CopyDebugInfo(target, pathToBuiltProject); DeleteOldSteamApiDlls(target, pathToBuiltProject); + + WriteSteamAppIdTxtFile(target, pathToBuiltProject); } static void CopyDebugInfo(BuildTarget target, string pathToBuiltProject) { @@ -71,6 +73,31 @@ static void DeleteOldSteamApiDlls(BuildTarget target, string pathToBuiltProject) } } } + + static void WriteSteamAppIdTxtFile(BuildTarget target, string pathToBuiltProject) + { + string basePath = Path.GetDirectoryName(pathToBuiltProject); + string strSteamAppIdPath = Path.Combine(basePath, "steam_appid.txt"); + + // If the steam_appid.txt file already exists, then there's nothing to do. + if (File.Exists(strSteamAppIdPath)) { + return; + } + + Debug.Log("[Steamworks.NET] 'steam_appid.txt' is not present in the project root. Writing..."); + + try { + StreamWriter appIdFile = File.CreateText(strSteamAppIdPath); + appIdFile.Write("480"); + appIdFile.Close(); + + Debug.Log("[Steamworks.NET] Successfully copied 'steam_appid.txt' into the project root."); + } + catch (System.Exception e) { + Debug.LogWarning("[Steamworks.NET] Could not copy 'steam_appid.txt' into the project root. Please place 'steam_appid.txt' into the project root manually."); + Debug.LogException(e); + } + } } #endif // !DISABLESTEAMWORKS