diff --git a/src/Sentry.Unity.Editor/Native/SwitchNativeStub.cs b/src/Sentry.Unity.Editor/Native/SwitchNativeStub.cs index 50b2b7e4c..a9966f4d8 100644 --- a/src/Sentry.Unity.Editor/Native/SwitchNativeStub.cs +++ b/src/Sentry.Unity.Editor/Native/SwitchNativeStub.cs @@ -75,9 +75,6 @@ private static bool Matches(string stub, string template) => private static string Normalize(string content) => content.Replace("\r\n", "\n").Replace("\r", "\n").TrimEnd(); - [InitializeOnLoadMethod] - private static void OnDomainReload() => EditorApplication.delayCall += () => Sync(null); - /// /// Syncs the SDK with the state of the game. Adds/removes the stub. /// @@ -213,7 +210,8 @@ private static string TemplatePath() => Path.GetFullPath(Path.Combine( internal class SwitchNativeStubWatcher : AssetPostprocessor { private static void OnPostprocessAllAssets( - string[] importedAssets, string[] deletedAssets, string[] movedAssets, string[] movedFromAssetPaths) + string[] importedAssets, string[] deletedAssets, string[] movedAssets, string[] movedFromAssetPaths, + bool didDomainReload) { var librariesChanged = importedAssets .Concat(deletedAssets) @@ -222,9 +220,9 @@ private static void OnPostprocessAllAssets( .Any(path => SwitchNativeStub.LibraryFileNames.Any( library => path.EndsWith(library, StringComparison.Ordinal))); - if (librariesChanged) + if (didDomainReload || librariesChanged) { - EditorApplication.delayCall += () => SwitchNativeStub.Sync(null); + SwitchNativeStub.Sync(null); } } } diff --git a/test/Scripts.Integration.Test/build-project.ps1 b/test/Scripts.Integration.Test/build-project.ps1 index 35a287637..01a0e5902 100644 --- a/test/Scripts.Integration.Test/build-project.ps1 +++ b/test/Scripts.Integration.Test/build-project.ps1 @@ -21,6 +21,11 @@ Write-Log "Build method: $buildMethod" Write-Detail "Output path: $outputPath" $unityArgs = @("-batchmode", "-projectPath ", "$(GetNewProjectPath)", "-executeMethod", $buildMethod , "-buildPath", $outputPath, "-quit") +if ($Platform -eq "Switch") +{ + $unityArgs += @("-buildTarget", "Switch") +} + RunUnityCustom $unityPath $unityArgs if ($Platform -eq "Android-Export")