-
Notifications
You must be signed in to change notification settings - Fork 262
Description
Hi,
If you have a project that uses SteamVR and you try to import it with Unity 2020.3, the SteamVR_Settings get reset.
A simple usecase where this matters is cloning the project onto a new machine from github. When you clone the project, it needs to be imported into unity and it needs to generate the library folder and all the related settings.
At the end of the import, SteamVR_Settings.instance will be called. This will trigger LoadInstance() which calls Resources.Load("SteamVR_Settings"). Normally, this would load the existing settings, but for whatever reason during project import this will not load anything and return null. Then the default settings will be generated instead and the actual settings file will be overwritten.
This is a big issue as it also happens when automating unity builds, causing a misconfigured build, making automation impossible.
This might be a Unity bug on an intentional behaviour of Resouces.Load(). Regardless there is a workaround:
#if UNITY_EDITOR
if (_instance == null)
{
_instance = UnityEditor.AssetDatabase.LoadAssetAtPath<SteamVR_Settings>("Assets/SteamVR_Resources/Resources/SteamVR_Settings.asset");
}
#endif
Adding this snippet of code in the SteamVR_Settings.LoadInstance() allows steamvr to still load everything during project import.
Hope this issue can be fixed/worked around in the plugin itself.