From 486901e1647592b22bfb5a53605625efcf2bc621 Mon Sep 17 00:00:00 2001 From: Pascal Jacob Date: Fri, 23 Jul 2021 16:00:30 +0200 Subject: [PATCH] Delay CopyExampleInputFiles from DidReloadScripts to editor update As Resource.Load fails and returns null during asset import SteamVR_Settings.instance cannot be called from DidReloadScripts Fixes #949 --- .../SteamVR/Input/Editor/SteamVR_CopyExampleInputFiles.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Assets/SteamVR/Input/Editor/SteamVR_CopyExampleInputFiles.cs b/Assets/SteamVR/Input/Editor/SteamVR_CopyExampleInputFiles.cs index 21626652..bfec7819 100644 --- a/Assets/SteamVR/Input/Editor/SteamVR_CopyExampleInputFiles.cs +++ b/Assets/SteamVR/Input/Editor/SteamVR_CopyExampleInputFiles.cs @@ -17,6 +17,13 @@ public class SteamVR_CopyExampleInputFiles : Editor [UnityEditor.Callbacks.DidReloadScripts] private static void OnReloadScripts() { + //Delay method calls as SteamVR_Settings.instance cannot be accessed from 'DidReloadScripts' + EditorApplication.update += Update; + } + + private static void Update() + { + EditorApplication.update -= Update; SteamVR_Input.CheckOldLocation(); CopyFiles(); }