Skip to content

Commit 19ef457

Browse files
committed
fix(SDK): use new hierarcyChanged event introduced in 2018.1
Unity 2018.1 deprecated the `hierarchyWindowChanged` event and is now called `hierarchyChanged` so the fix is to do a script define to use the correct event based on the version.
1 parent 97cc00b commit 19ef457

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

Assets/VRTK/Source/Scripts/Utilities/SDK/VRTK_SDKManager.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -819,8 +819,14 @@ static VRTK_SDKManager()
819819
PopulateAvailableAndInstalledSDKInfos();
820820

821821
#if UNITY_EDITOR
822+
822823
//call AutoManageScriptingDefineSymbolsAndManageVRSettings when the currently active scene changes
824+
#if UNITY_2018_1_OR_NEWER
825+
EditorApplication.hierarchyChanged += AutoManageScriptingDefineSymbolsAndManageVRSettings;
826+
#else
823827
EditorApplication.hierarchyWindowChanged += AutoManageScriptingDefineSymbolsAndManageVRSettings;
828+
#endif
829+
824830
#endif
825831
}
826832

Assets/VRTK/Source/Scripts/Utilities/SDK/VRTK_SDKSetup.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,11 @@ private void OnEnable()
423423
static VRTK_SDKSetup()
424424
{
425425
//call AutoPopulateObjectReferences when the currently active scene changes
426+
#if UNITY_2018_1_OR_NEWER
427+
EditorApplication.hierarchyChanged += AutoPopulateObjectReferences;
428+
#else
426429
EditorApplication.hierarchyWindowChanged += AutoPopulateObjectReferences;
430+
#endif
427431
}
428432

429433
[DidReloadScripts(2)]

0 commit comments

Comments
 (0)