Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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 join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants