diff --git a/test/Scripts.Integration.Test/Editor/XboxPersistentLocalStorage.cs b/test/Scripts.Integration.Test/Editor/XboxPersistentLocalStorage.cs
index 11c9e64d5..dcb64fba6 100644
--- a/test/Scripts.Integration.Test/Editor/XboxPersistentLocalStorage.cs
+++ b/test/Scripts.Integration.Test/Editor/XboxPersistentLocalStorage.cs
@@ -38,7 +38,11 @@ public void OnPreprocessBuild(BuildReport report)
pls.InnerXml = "1122";
- doc.Save(configPath);
+ // Unity watches the game config and re-reads it on change. Saving in place can make that read hit
+ // a sharing violation mid-write, which fails the build in strict mode. Swap in a complete file instead.
+ var tempPath = Path.Combine("Temp", configName);
+ doc.Save(tempPath);
+ File.Replace(tempPath, configPath, null);
Debug.Log($"XboxPersistentLocalStorage: Configured PersistentLocalStorage in {configName}");
}
}