diff --git a/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/Editor/IntegrationTestsRunnerWindow.cs b/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/Editor/IntegrationTestsRunnerWindow.cs index 1ced5dd6..0469e664 100644 --- a/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/Editor/IntegrationTestsRunnerWindow.cs +++ b/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/Editor/IntegrationTestsRunnerWindow.cs @@ -63,11 +63,20 @@ namespace UnityTest EditorApplication.hierarchyWindowChanged += OnHierarchyChangeUpdate; EditorApplication.update -= BackgroundSceneChangeWatch; EditorApplication.update += BackgroundSceneChangeWatch; +#if UNITY_2017_2_OR_NEWER + EditorApplication.playModeStateChanged -= OnPlaymodeStateChanged; + EditorApplication.playModeStateChanged += OnPlaymodeStateChanged; +#else EditorApplication.playmodeStateChanged -= OnPlaymodeStateChanged; EditorApplication.playmodeStateChanged += OnPlaymodeStateChanged; +#endif } +#if UNITY_2017_2_OR_NEWER + private static void OnPlaymodeStateChanged(PlayModeStateChange stateChange) +#else private static void OnPlaymodeStateChanged() +#endif { if (s_Instance && EditorApplication.isPlaying == EditorApplication.isPlayingOrWillChangePlaymode) s_Instance.RebuildTestList(); @@ -78,7 +87,11 @@ namespace UnityTest EditorApplication.hierarchyWindowItemOnGUI -= OnHierarchyWindowItemDraw; EditorApplication.update -= BackgroundSceneChangeWatch; EditorApplication.hierarchyWindowChanged -= OnHierarchyChangeUpdate; +#if UNITY_2017_2_OR_NEWER + EditorApplication.playModeStateChanged -= OnPlaymodeStateChanged; +#else EditorApplication.playmodeStateChanged -= OnPlaymodeStateChanged; +#endif TestComponent.DestroyAllDynamicTests(); }