vrm-c / UniVRM

UniVRM is a gltf-based VRM format implementation for Unity. English is here https://vrm.dev/en/ . 日本語 はこちら https://vrm.dev/
https://vrm.dev/en
MIT License
2.52k stars 411 forks source link

NullReferenceException when Export VRM file from VRChat avatar #2274

Open Yunhyuk-Jeong opened 3 months ago

Yunhyuk-Jeong commented 3 months ago

Environments (please complete the following information):

Describe the bug

System.NullReferenceException: Object reference not set to an instance of an object
  at UniGLTF.MeshUtility.MeshAttachInfo+<>c__DisplayClass4_0.<ReplaceMesh>b__0 (UnityEngine.Transform x) [0x00000] in .\Library\PackageCache\com.vrmc.gltf@640fabea73\Runtime\MeshUtility\MeshAttachInfo.cs:23 
  at (wrapper delegate-invoke) System.Func`2[UnityEngine.Transform,UnityEngine.Matrix4x4].invoke_TResult_T(UnityEngine.Transform)
  at System.Linq.Enumerable+SelectArrayIterator`2[TSource,TResult].ToArray () [0x00012] in <de4a1a1490a74771a34fee0d1d586658>:0 
  at System.Linq.Enumerable.ToArray[TSource] (System.Collections.Generic.IEnumerable`1[T] source) [0x0001f] in <de4a1a1490a74771a34fee0d1d586658>:0 
  at UniGLTF.MeshUtility.MeshAttachInfo.ReplaceMesh (UnityEngine.GameObject dst) [0x00029] in .\Library\PackageCache\com.vrmc.gltf@640fabea73\Runtime\MeshUtility\MeshAttachInfo.cs:23 
  at UniGLTF.MeshUtility.BoneNormalizer.Replace (UnityEngine.GameObject go, System.Collections.Generic.Dictionary`2[TKey,TValue] meshMap, System.Boolean FreezeRotation, System.Boolean FreezeScaling) [0x000f1] in .\Library\PackageCache\com.vrmc.gltf@640fabea73\Runtime\MeshUtility\BoneNormalizer.cs:101 
  at VRM.VRMBoneNormalizer.Execute (UnityEngine.GameObject go, System.Boolean forceTPose) [0x00040] in .\Library\PackageCache\com.vrmc.univrm@640fabea73\Runtime\SkinnedMeshUtility\VRMBoneNormalizer.cs:85 
  at Esperecyan.Unity.VRMConverterForVRChat.VRChatToVRM.VRChatToVRMConverter.Convert (System.String version, System.String outputPath, UnityEngine.GameObject instance, VRM.VRMMetaObject meta, System.Collections.Generic.IDictionary`2[TKey,TValue] presetVRChatBindingPairs, System.Boolean keepUnusedShapeKeys) [0x0020b] in .\Library\PackageCache\jp.pokemori.vrm-converter-for-vrchat@41.1.0\Editor\VRChatToVRM\VRChatToVRMConverter.cs:167 
  at Esperecyan.Unity.VRMConverterForVRChat.UI.VRChatToVRMWizard.OnWizardCreate () [0x001b2] in .\Library\PackageCache\jp.pokemori.vrm-converter-for-vrchat@41.1.0\Editor\UI\VRChatToVRMWizard.cs:309 
  at (wrapper managed-to-native) System.Reflection.RuntimeMethodInfo.InternalInvoke(System.Reflection.RuntimeMethodInfo,object,object[],System.Exception&)
  at System.Reflection.RuntimeMethodInfo.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x0006a] in <eef08f56e2e042f1b3027eca477293d9>:0 
  at UniGLTF.MeshUtility.MeshAttachInfo+<>c__DisplayClass4_0.<ReplaceMesh>b__0 (UnityEngine.Transform x) [0x00000] in .\Library\PackageCache\com.vrmc.gltf@640fabea73\Runtime\MeshUtility\MeshAttachInfo.cs:23 
  at (wrapper delegate-invoke) System.Func`2[UnityEngine.Transform,UnityEngine.Matrix4x4].invoke_TResult_T(UnityEngine.Transform)
  at System.Linq.Enumerable+SelectArrayIterator`2[TSource,TResult].ToArray () [0x00012] in <de4a1a1490a74771a34fee0d1d586658>:0 
  at System.Linq.Enumerable.ToArray[TSource] (System.Collections.Generic.IEnumerable`1[T] source) [0x0001f] in <de4a1a1490a74771a34fee0d1d586658>:0 
  at UniGLTF.MeshUtility.MeshAttachInfo.ReplaceMesh (UnityEngine.GameObject dst) [0x00029] in .\Library\PackageCache\com.vrmc.gltf@640fabea73\Runtime\MeshUtility\MeshAttachInfo.cs:23 
  at UniGLTF.MeshUtility.BoneNormalizer.Replace (UnityEngine.GameObject go, System.Collections.Generic.Dictionary`2[TKey,TValue] meshMap, System.Boolean FreezeRotation, System.Boolean FreezeScaling) [0x000f1] in .\Library\PackageCache\com.vrmc.gltf@640fabea73\Runtime\MeshUtility\BoneNormalizer.cs:101 
  at VRM.VRMBoneNormalizer.Execute (UnityEngine.GameObject go, System.Boolean forceTPose) [0x00040] in .\Library\PackageCache\com.vrmc.univrm@640fabea73\Runtime\SkinnedMeshUtility\VRMBoneNormalizer.cs:85 
  at Esperecyan.Unity.VRMConverterForVRChat.VRChatToVRM.VRChatToVRMConverter.Convert (System.String version, System.String outputPath, UnityEngine.GameObject instance, VRM.VRMMetaObject meta, System.Collections.Generic.IDictionary`2[TKey,TValue] presetVRChatBindingPairs, System.Boolean keepUnusedShapeKeys) [0x0020b] in .\Library\PackageCache\jp.pokemori.vrm-converter-for-vrchat@41.1.0\Editor\VRChatToVRM\VRChatToVRMConverter.cs:167 
  at Esperecyan.Unity.VRMConverterForVRChat.UI.VRChatToVRMWizard.OnWizardCreate () [0x001b2] in .\Library\PackageCache\jp.pokemori.vrm-converter-for-vrchat@41.1.0\Editor\UI\VRChatToVRMWizard.cs:309 
  at (wrapper managed-to-native) System.Reflection.RuntimeMethodInfo.InternalInvoke(System.Reflection.RuntimeMethodInfo,object,object[],System.Exception&)
  at System.Reflection.RuntimeMethodInfo.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x0006a] in <eef08f56e2e042f1b3027eca477293d9>:0

What should I do?

ousttrue commented 1 month ago

The ones used for skinning (bones in SkinnedMeshRenderer.bones, bones with boneWeight, etc.) are Please do not delete it.

ousttrue commented 1 week ago

2326