Skip to content
This repository was archived by the owner on May 9, 2025. It is now read-only.

just use aSceneReference then error #171

Open
FirepadCN opened this issue May 24, 2024 · 1 comment
Open

just use aSceneReference then error #171

FirepadCN opened this issue May 24, 2024 · 1 comment

Comments

@FirepadCN
Copy link

just use aSceneReference then error

UnityException: Calls to "AssetDatabase.LoadAssetAtPath" are restricted during domain backup. Assets may not be loaded while domain backup is running, as this will change the underlying state.
UnityEditor.AssetDatabase.LoadAssetAtPath[T] (System.String assetPath) (at <599499f170ad48e4856b76baa93bb22f>:0)
ScriptableObjectArchitecture.SceneInfo.get_Scene () (at Assets/ThirdParty/SO Architecture/Variables/SceneVariable.cs:80)
ScriptableObjectArchitecture.SceneInfo.OnBeforeSerialize () (at Assets/ThirdParty/SO Architecture/Variables/SceneVariable.cs:107)

@TheCollectorOfSouls
Copy link

try to change the Scene return in SceneInfo class to this:

    #if UNITY_EDITOR
    private UnityEditor.SceneAsset _cacheScene;
    internal UnityEditor.SceneAsset Scene
    {
        get {
            try
            {
                var scene = UnityEditor.AssetDatabase.LoadAssetAtPath<UnityEditor.SceneAsset>(_sceneName);
                _cacheScene = scene;
                return _cacheScene;
            }
            catch (Exception)
            {
                return _cacheScene;
            }
        }
    }
    #endif

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants