Skip to content

Unity 6 SVG Import fails (caused by AssetDatabase.StartAssetEditing()) #16

@cpwfx

Description

@cpwfx

Hello,

and thank you for your effort for a great library that we purchased for our use in the Asset Store years ago.
Fyi, there is a new bug with importing SVGs into Unity 6, which causes Unity not find the asset path after which Unity's state is no longer stable and crashes.

The bug is reported to Unity, hopefully fixed in 6000.0.33f1+

Assertion failed on expression: '!pathName.empty()'
UnityEditor.AssetDatabase:AddObjectToAsset (UnityEngine.Object,UnityEngine.Object)
SVGImporter.SVGAssetImport:AddObjectToAsset<UnityEngine.Mesh> (UnityEngine.Mesh,SVGImporter.SVGAsset,UnityEngine.HideFlags) (at Assets/3rdparty/SVG Importer/Plugins/Core/SVGAssetImport.cs:315)
SVGImporter.SVGAssetImport:StartProcess (SVGImporter.SVGAsset) (at Assets/3rdparty/SVG Importer/Plugins/Core/SVGAssetImport.cs:178)
SVGImporter.SVGAsset:_editor_LoadSVG () (at Assets/3rdparty/SVG Importer/Plugins/Core/SVGAsset.cs:1692)
SVGImporter.SVGAsset:_editor_ApplyChanges (bool) (at Assets/3rdparty/SVG Importer/Plugins/Core/SVGAsset.cs:1534)
System.Reflection.MethodBase:Invoke (object,object[])
SVGImporter.SVGPostprocessor:ImportVGAsset (string) (at Assets/3rdparty/SVG Importer/Editor/AssetPostprocessor/SVGPostprocessor.cs:243)
SVGImporter.SVGPostprocessor:OnPostprocessAllAssets (string[],string[],string[],string[]) (at Assets/3rdparty/SVG Importer/Editor/AssetPostprocessor/SVGPostprocessor.cs:154)
UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)

This can be prevented by disabling StartAssetEditing() in SVGPostProcessor.cs:128, after this import seems to work again.

			if(importTotalAssets + reImportTotalAssets > 0)
			{				
				// AssetDatabase.StartAssetEditing();
			} else {
				EditorUtility.ClearProgressBar();
				importSVGAssets.Clear();
				importSVGAssets = null;
				reimportSVGAssets.Clear();
				reimportSVGAssets = null;
				return;
			}

....

// AssetDatabase.StopAssetEditing();

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions