Skip to content

A Civilization-style strategy game about governing Israel from 15 May 1948. Real ministers, real map, every fact sourced. Unity + deterministic C# sim.

fix(settings): Debug.Log lines carry no stack trace in players (Task 24 review M9)

eyalgolana428286c0d88
diff --git a/unity/Assets/Editor/ProjectSetup.cs b/unity/Assets/Editor/ProjectSetup.cs
index 55b3c4b43..2b772de42 100644
--- a/unity/Assets/Editor/ProjectSetup.cs
+++ b/unity/Assets/Editor/ProjectSetup.cs
@@ -1,5 +1,6 @@
using UnityEditor;
using UnityEditor.Build;
+using UnityEngine;
namespace Statecraft.Game.EditorTools
{
@@ -21,6 +22,8 @@ namespace Statecraft.Game.EditorTools
PlayerSettings.WebGL.template = WebTemplate;
PlayerSettings.WebGL.compressionFormat = WebGLCompressionFormat.Disabled;
PlayerSettings.WebGL.decompressionFallback = false;
+ // Debug.Log lines (GAME OK, TURN, PROFILE) without a script stack trace; warnings and errors keep theirs (Task 24 review M9).
+ PlayerSettings.SetStackTraceLogType(LogType.Log, StackTraceLogType.None);
var player = new SerializedObject(AssetDatabase.LoadAllAssetsAtPath("ProjectSettings/ProjectSettings.asset")[0]);
var template = player.FindProperty("templateDefaultScene"); // no public API; the sample scene it named is gone
if (template != null && template.stringValue != BootScene) { template.stringValue = BootScene; player.ApplyModifiedPropertiesWithoutUndo(); }
diff --git a/unity/Assets/Tests/EditMode/ProjectSettingsTests.cs b/unity/Assets/Tests/EditMode/ProjectSettingsTests.cs
index 91555ede0..e20cec378 100644
--- a/unity/Assets/Tests/EditMode/ProjectSettingsTests.cs
+++ b/unity/Assets/Tests/EditMode/ProjectSettingsTests.cs
@@ -43,4 +43,14 @@ public class ProjectSettingsTests
StringAssert.DoesNotContain("\"" + p + "\"", manifest);
Assert.IsFalse(File.Exists("Assets/Scenes/SampleScene.unity"));
}
+
+ /// <summary>Task 24 review M9: Debug.Log lines (GAME OK, TURN, PROFILE) print without a script stack trace in players;
+ /// warnings, errors and exceptions keep theirs.</summary>
+ [Test]
+ public void LogLinesCarryNoStackTraceButErrorsDo()
+ {
+ Assert.AreEqual(UnityEngine.StackTraceLogType.None, PlayerSettings.GetStackTraceLogType(UnityEngine.LogType.Log));
+ foreach (var t in new[] { UnityEngine.LogType.Error, UnityEngine.LogType.Assert, UnityEngine.LogType.Warning, UnityEngine.LogType.Exception })
+ Assert.AreEqual(UnityEngine.StackTraceLogType.ScriptOnly, PlayerSettings.GetStackTraceLogType(t), t.ToString());
+ }
}
diff --git a/unity/ProjectSettings/ProjectSettings.asset b/unity/ProjectSettings/ProjectSettings.asset
index e9f867f66..52c337cfe 100644
--- a/unity/ProjectSettings/ProjectSettings.asset
+++ b/unity/ProjectSettings/ProjectSettings.asset
@@ -55,7 +55,7 @@ PlayerSettings:
mipStripping: 0
numberOfMipsStripped: 0
numberOfMipsStrippedPerMipmapLimitGroup: {}
- m_StackTraceTypes: 010000000100000001000000010000000100000001000000
+ m_StackTraceTypes: 010000000100000001000000000000000100000001000000
iosShowActivityIndicatorOnLoading: -1
androidShowActivityIndicatorOnLoading: -1
iosUseCustomAppBackgroundBehavior: 0