Jump to content

Path related backslashes in code breaking Unity MacOs Asset import :)


SnotOt

Recommended Posts

Hi everyone, I was trying out Scene Optimizer in Unity 2022.3.4 on MacOs and noticed that it fails when Scene Optimizer is trying to add its optimised assets to the project. As an abbreviated example, it throws a UnityException: Creating asset at path Assets/XX/XX/Scenes\Demo_Scene_1\Small Objects/XX.asset failed etc. etc. The thing to take note of here are the pesky backslashes in the path. What happens next is that Unity is stuck in a AssetDatabase.StartAssetEditing() state and the Editor gets stuck in a never ending Importing assets loop, because it's not hitting that "AssetDatabase.StopAssetEditing();" code in SceneOptimizer.cs. 319GB of memory usage later left a burning hole in the floor where my Mac used to be. I had a quick look at the code and replaced (not the LEET way to do this) the path related backslashes in EditorEvents.cs (see meshPath and filePath variables) and  SceneOptimizer.cs (see fullPath variable) which did the trick for me. Hope this helps someone 🙂 

  • Thanks 1
Link to comment

Hey @SnotOt!

Thanks for notifying us about this problem. I've gone ahead and fixed those to be forward slashes for the sake of it working in MacOS. I also fixed the 'AssetDatabase.StopAssetEditing' problem by encasing it in a 'try' + 'finally' catch block. It seemed to fix that issue as well. Stay tuned for the new big version of the Scene Optimizer!

  • Thanks 1
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Tell a friend

    Love Canopy - Procedural Worlds? Tell a friend!
  • Need help?

    We work with some of the biggest brands in global gaming, automotive, technology, and government to create environments, games, simulations, and product launches for desktop, mobile, and VR.

    Our unique expertise and technology enable us to deliver solutions that look and run better at a fraction of the time and cost of a typical project.

    Check out some of our non-NDA work in the Gallery, and then Contact Us to accelerate your next project!

×
×
  • Create New...