Skip to content

Importing a project in Unity 2020.3 causes SteamVR_Settings to reset #949

@viliusnbg

Description

@viliusnbg

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions