void OnEnable() { //if we're firing OnEnable, this means any compilation has ended. We're good! loadingCustomDefine = false; //look for CurvedUI custom EventSystem -> we'll check later if it makes sense to have one. CUIeventSystemPresent = (FindObjectsOfType(typeof(CurvedUIEventSystem)).Length > 0); //hacky way to make sure event is connected only once, but it works! #if UNITY_2018 || UNITY_2019 EditorApplication.hierarchyChanged -= AddCurvedUIComponents; EditorApplication.hierarchyChanged -= AddCurvedUIComponents; EditorApplication.hierarchyChanged += AddCurvedUIComponents; #else //hacky way to make sure event is connected only once, but it works! EditorApplication.hierarchyWindowChanged -= AddCurvedUIComponents; EditorApplication.hierarchyWindowChanged -= AddCurvedUIComponents; EditorApplication.hierarchyWindowChanged += AddCurvedUIComponents; #endif //check if the currently selected control method is enabled in editor. //Otherwise, show error. if (Application.isPlaying) { CurvedUISettings myTarget = (CurvedUISettings)target; string define = PlayerSettings.GetScriptingDefineSymbolsForGroup(EditorUserBuildSettings.selectedBuildTargetGroup); foreach (var key in ControlMethodDefineDict.Keys) { if (myTarget.ControlMethod == key && !define.Contains(ControlMethodDefineDict[key])) { Debug.LogError("CURVEDUI: Selected control method (" + key.ToString() + ") is not enabled. Enable it on CurvedUISettings component", myTarget.gameObject); } } } #if CURVEDUI_STEAMVR_2 //Get action and their paths to show in the popup. steamVRActions = SteamVR_Input.GetActions <SteamVR_Action_Boolean>(); steamVRActionsPaths = new string[] { "None" }; if (steamVRActions != null && steamVRActions.Length > 0) { List <string> enumList = new List <string>(); //add all action paths to list. for (int i = 0; i < steamVRActions.Length; i++) { enumList.Add(steamVRActions[i].fullPath); } enumList.Add("None"); //need a way to null that field, so add None as last pick. //replace forward slashes with backslack instead. Otherwise they will not show up. for (int index = 0; index < enumList.Count; index++) { enumList[index] = enumList[index].Replace('/', '\\'); } steamVRActionsPaths = enumList.ToArray(); } #endif }