simplestargame / SimpleURPToonLitOutlineExample

SimpleURPToonLitOutlineExample

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error when importing VRM 0.x: "Destroy may not be called from edit mode! Use DestroyImmediate instead."

3ternal opened this issue · comments

I'm getting several instances of the following error when I import a VRM 0.x file.

Destroy may not be called from edit mode! Use DestroyImmediate instead.
Destroying an object in edit mode destroys it permanently.
UnityEngine.Object:Destroy (UnityEngine.Object)
VRMShaders.MaterialFactory/<LoadAsync>d__10:MoveNext () (at Assets/_Asset Store/VRMShaders/GLTF/IO/Runtime/Material/Importer/MaterialFactory.cs:136)
System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1<UnityEngine.Material>:Start<VRMShaders.MaterialFactory/<LoadAsync>d__10> (VRMShaders.MaterialFactory/<LoadAsync>d__10&)
VRMShaders.MaterialFactory:LoadAsync (VRMShaders.MaterialDescriptor,VRMShaders.GetTextureAsyncFunc,VRMShaders.IAwaitCaller)
UniGLTF.ImporterContext/<LoadMaterialsAsync>d__37:MoveNext () (at Assets/_Asset Store/UniGLTF/Runtime/UniGLTF/IO/ImporterContext.cs:301)
System.Runtime.CompilerServices.AsyncTaskMethodBuilder:Start<UniGLTF.ImporterContext/<LoadMaterialsAsync>d__37> (UniGLTF.ImporterContext/<LoadMaterialsAsync>d__37&)
UniGLTF.ImporterContext:LoadMaterialsAsync (VRMShaders.IAwaitCaller)
VRM.VRMEditorImporterContext:ConvertAndExtractImages (System.Action`1<System.Collections.Generic.IEnumerable`1<UniGLTF.UnityPath>>) (at Assets/_Asset Store/VRM/Editor/Format/VRMEditorImporterContext.cs:84)
VRM.vrmAssetPostprocessor:ImportVrmAndCreatePrefab (string,UniGLTF.UnityPath) (at Assets/_Asset Store/VRM/Editor/Format/vrmAssetPostprocessor.cs:102)
VRM.vrmAssetPostprocessor:ImportVrm (UniGLTF.UnityPath) (at Assets/_Asset Store/VRM/Editor/Format/vrmAssetPostprocessor.cs:57)
VRM.vrmAssetPostprocessor:OnPostprocessAllAssets (string[],string[],string[],string[]) (at Assets/_Asset Store/VRM/Editor/Format/vrmAssetPostprocessor.cs:37)
UnityEditor.AssetPostprocessingInternal:PostprocessAllAssets (string[],string[],string[],string[],string[],bool)

This is after copying your version of MaterialFactory.cs into the appropriate folder, of course. I would try this with VRM 1.0 if I could, but I'm hitting an error when migrating from 0.x to 1.0, and I think that's unrelated to this asset.

Current versions:
Unity 2022.3.6
UniVRM-0.115.0_7e05.unitypackage
VRM-0.115.0_7e05.unitypackage
SimpleURPToonLitOutlineExample_for0.108.0.unitypackage

Interestingly, the error doesn't seem to break the import process at all - I can still drag the resulting prefab into the scene, and it seems to work correctly.