Hello everyone, thank you in advance for reviewing my post!
I am using a custom editor menu button to import a package, containing a scene, then immediately attempting to open that scene… all in one operation. The scene is reported as not being found at the provided path. If I run the operation again (package is already imported at this point), the scene loads find. The path value remains the same in both instances.
Error: ArgumentException: Cannot open scene with path “Assets/Scenes/SceneNameHere.unity”.
Code:
AssetDatabase.ImportPackage(path, false);
AssetDatabase.Refresh(ImportAssetOptions.ForceSynchronousImport);
EditorSceneManager.OpenScene(path, OpenSceneMode.Single);
Anything obvious I am missing? Do I need to “wait” for some async operation to finish, despite forcing it to be synchronous?
I also added a small hack between the asset refresh and scene load, but to no avail:
while(EditorApplication.isCompiling && EditorApplication.isUpdating) {}
Unity Version: 5.3.0.f4
System Info:
OS: Windows 8.1 Pro
Ram: 16 GB
System: 64-bit
Processor: Intel i7-4850HQ