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.58k stars 418 forks source link

Key miss #290

Closed superowner closed 4 years ago

superowner commented 5 years ago

a key miss when export a vrm

KeyNotFoundException: The given key was not present in the dictionary. UniGLTF.UnityExtensions.GetChildByName (UnityEngine.Transform self, System.String childName) (at Assets/VRM/UniGLTF/Scripts/Extensions/UnityExtensions.cs:185) UniGLTF.UnityExtensions.GetFromPath (UnityEngine.Transform self, System.String path) (at Assets/VRM/UniGLTF/Scripts/Extensions/UnityExtensions.cs:196) UniGLTF.AnimationExporter.GetNodeIndex (UnityEngine.Transform root, System.Collections.Generic.List1[T] nodes, System.String path) (at Assets/VRM/UniGLTF/Scripts/IO/AnimationExporter.cs:62) UniGLTF.AnimationExporter.Export (UnityEngine.AnimationClip clip, UnityEngine.Transform root, System.Collections.Generic.List1[T] nodes) (at Assets/VRM/UniGLTF/Scripts/IO/AnimationExporter.cs:144) UniGLTF.gltfExporter.FromGameObject (UniGLTF.glTF gltf, UnityEngine.GameObject go, System.Boolean useSparseAccessorForMorphTarget) (at Assets/VRM/UniGLTF/Scripts/IO/gltfExporter.cs:305) UniGLTF.gltfExporter.Export () (at Assets/VRM/UniGLTF/Scripts/IO/gltfExporter.cs:138) VRM.VRMExporter._Export (UniGLTF.glTF gltf, VRM.VRMExporter exporter, UnityEngine.GameObject go) (at Assets/VRM/UniVRM/Scripts/Format/VRMExporter.cs:42) VRM.VRMExporter.Export (UnityEngine.GameObject go) (at Assets/VRM/UniVRM/Scripts/Format/VRMExporter.cs:34) VRM.VRMExportSettings.Export (System.String path, System.Collections.Generic.List`1[T] destroy) (at Assets/VRM/UniVRM/Scripts/Format/VRMExportSettings.cs:274) VRM.VRMExportSettings.Export (System.String path) (at Assets/VRM/UniVRM/Scripts/Format/VRMExportSettings.cs:238) VRM.VRMExporterWizard.OnWizardCreate () (at Assets/VRM/UniVRM/Editor/Format/VRMExporterMenu.cs:42) System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at :0) Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation. System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at :0) System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at :0) UnityEditor.ScriptableWizard.OnGUI () (at C:/buildslave/unity/build/Editor/Mono/ScriptableWizard.cs:79) System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at :0) Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation. System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at :0) System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at :0) UnityEditor.HostView.Invoke (System.String methodName, System.Object obj) (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:342) UnityEditor.HostView.Invoke (System.String methodName) (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:336) UnityEditor.HostView.OldOnGUI () (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:129) UnityEngine.Experimental.UIElements.IMGUIContainer.DoOnGUI (UnityEngine.Event evt, UnityEngine.Matrix4x4 worldTransform, UnityEngine.Rect clippingRect, System.Boolean isComputingLayout) (at C:/buildslave/unity/build/Modules/UIElements/IMGUIContainer.cs:266) UnityEngine.Experimental.UIElements.IMGUIContainer.HandleIMGUIEvent (UnityEngine.Event e, UnityEngine.Matrix4x4 worldTransform, UnityEngine.Rect clippingRect) (at C:/buildslave/unity/build/Modules/UIElements/IMGUIContainer.cs:438) UnityEngine.Experimental.UIElements.IMGUIContainer.HandleIMGUIEvent (UnityEngine.Event e) (at C:/buildslave/unity/build/Modules/UIElements/IMGUIContainer.cs:421) UnityEngine.Experimental.UIElements.IMGUIContainer.HandleEvent (UnityEngine.Experimental.UIElements.EventBase evt) (at C:/buildslave/unity/build/Modules/UIElements/IMGUIContainer.cs:401) UnityEngine.Experimental.UIElements.EventDispatcher.ProcessEvent (UnityEngine.Experimental.UIElements.EventBase evt, UnityEngine.Experimental.UIElements.IPanel panel) (at C:/buildslave/unity/build/Modules/UIElements/EventDispatcher.cs:511) UnityEngine.Experimental.UIElements.EventDispatcher.Dispatch (UnityEngine.Experimental.UIElements.EventBase evt, UnityEngine.Experimental.UIElements.IPanel panel, UnityEngine.Experimental.UIElements.DispatchMode dispatchMode) (at C:/buildslave/unity/build/Modules/UIElements/EventDispatcher.cs:307) UnityEngine.Experimental.UIElements.BaseVisualElementPanel.SendEvent (UnityEngine.Experimental.UIElements.EventBase e, UnityEngine.Experimental.UIElements.DispatchMode dispatchMode) (at C:/buildslave/unity/build/Modules/UIElements/Panel.cs:176) UnityEngine.Experimental.UIElements.UIElementsUtility.DoDispatch (UnityEngine.Experimental.UIElements.BaseVisualElementPanel panel) (at C:/buildslave/unity/build/Modules/UIElements/UIElementsUtility.cs:245) UnityEngine.Experimental.UIElements.UIElementsUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr) (at C:/buildslave/unity/build/Modules/UIElements/UIElementsUtility.cs:68) UnityEngine.GUIUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr) (at C:/buildslave/unity/build/Modules/IMGUI/GUIUtility.cs:179)

hiroj commented 5 years ago

image Thanks for the report Please empty AnimationController of Animator at the time of VRM export

superowner commented 5 years ago

image Thanks for the report Please empty AnimationController of Animator at the time of VRM export

Hello, I find just when using "Use Experimental Export", Unity shows the error

hiroj commented 4 years ago

The version has been updated so please try again with the new version. It would be helpful if you could write the reproduction procedure.

hiroj commented 4 years ago

If there is a problem please reopen.

ghost commented 3 years ago

I`m having the same problem in the version UniVRM-0.63.1_d8d9

Error description on use vrm exported with the plugin image

Exportation image image image image

Console exportation unknown shader VRM_USE_GLTFSHADER. UnityEngine.Debug:LogWarningFormat(String, Object[]) VRM.VRMMaterialImporter:CreateMaterial(Int32, glTFMaterial, Boolean) (at Assets/VRM/Runtime/IO/VRMMaterialImporter.cs:51) UniGLTF.d49:MoveNext() (at Assets/UniGLTF/Runtime/UniGLTF/IO/ImporterContext.cs:671) DepthFirstScheduler.CoroutineFunctor1:Execute() (at Assets/UniGLTF/Runtime/DepthFirstScheduler/Functor.cs:118) DepthFirstScheduler.Schedulable1:Execute() (at Assets/UniGLTF/Runtime/DepthFirstScheduler/Schedulable.cs:102) DepthFirstScheduler.Schedulable`1:ExecuteAll() (at Assets/UniGLTF/Runtime/DepthFirstScheduler/Schedulable.cs:114) UniGLTF.ImporterContext:Load() (at Assets/UniGLTF/Runtime/UniGLTF/IO/ImporterContext.cs:488) VRM.<>cDisplayClass1_0:b__0() (at Assets/VRM/Editor/Format/vrmAssetPostprocessor.cs:62) UnityEditor.EditorApplication:Internal_CallDelayFunctions()

Can't add component 'Animator' to Almond_(with Sports wear)(Clone)(normalized) because such a component is already added to the game object! UnityEngine.GameObject:AddComponent() VRM.<>c__DisplayClass1_0:b__0(GameObject, GameObject, Dictionary2) (at Assets/VRM/Runtime/SkinnedMeshUtility/VRMBoneNormalizer.cs:86) MeshUtility.BoneNormalizer:NormalizeHierarchy(GameObject, CreateAvatarFunc) (at Assets/UniGLTF/MeshUtility/Runtime/BoneNormalizer.cs:29) MeshUtility.BoneNormalizer:Execute(GameObject, CreateAvatarFunc) (at Assets/UniGLTF/MeshUtility/Runtime/BoneNormalizer.cs:490) VRM.VRMBoneNormalizer:Execute(GameObject, Boolean) (at Assets/VRM/Runtime/SkinnedMeshUtility/VRMBoneNormalizer.cs:69) VRM.VRMEditorExporter:Export(String, GameObject, VRMMetaObject, VRMExportSettings, IReadOnlyList1, List1) (at Assets/VRM/Editor/Format/VRMEditorExporter.cs:199) VRM.VRMEditorExporter:Export(String, GameObject, VRMMetaObject, VRMExportSettings, IReadOnlyList1) (at Assets/VRM/Editor/Format/VRMEditorExporter.cs:24) VRM.VRMExporterWizard:OnExportClicked(GameObject, VRMMetaObject, VRMExportSettings, VRMExportMeshes) (at Assets/VRM/Editor/Format/VRMExporterWizard.cs:413) VRM.VRMExporterWizard:OnGUI() (at Assets/VRM/Editor/Format/VRMExporterWizard.cs:229) UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

image

Someone know how fix it?

Armint49 commented 3 years ago

I too have this problem but I don't know how to fix it

Sigvaldas commented 1 year ago

I too have this problem but I don't know how to fix it

So in my case I had .fbx mesh which was exported out of "Blender". By default when exporting .fbx out of blender it has "add leaf bones" option enabled so when I import that .fbx into unity some of my bones have additional bone with suffix _end. I wanted to delete those bones and I did it by deselecting "Add leaf bones" in blender. After that the fbx works as expected, it doesn't have additonal bones with _end suffix. So my issue was that I never updated by .glb file. VRM format takes animation file from glb file and in my case I just had to export .glb file out of blender (after I deleted those _end bones). After that unity sees all bones properly even tho before it tried to find all bones and some of them were missing because .gld bile had _end bones while .fbx didn't. That's how I fixed it.

a key miss when export a vrm

KeyNotFoundException: The given key was not present in the dictionary. UniGLTF.UnityExtensions.GetChildByName (UnityEngine.Transform self, System.String childName) (at Assets/VRM/UniGLTF/Scripts/Extensions/UnityExtensions.cs:185) UniGLTF.UnityExtensions.GetFromPath (UnityEngine.Transform self, System.String path) (at Assets/VRM/UniGLTF/Scripts/Extensions/UnityExtensions.cs:196) UniGLTF.AnimationExporter.GetNodeIndex (UnityEngine.Transform root, System.Collections.Generic.List1[T] nodes, System.String path) (at Assets/VRM/UniGLTF/Scripts/IO/AnimationExporter.cs:62) UniGLTF.AnimationExporter.Export (UnityEngine.AnimationClip clip, UnityEngine.Transform root, System.Collections.Generic.List1[T] nodes) (at Assets/VRM/UniGLTF/Scripts/IO/AnimationExporter.cs:144) UniGLTF.gltfExporter.FromGameObject (UniGLTF.glTF gltf, UnityEngine.GameObject go, System.Boolean useSparseAccessorForMorphTarget) (at Assets/VRM/UniGLTF/Scripts/IO/gltfExporter.cs:305) UniGLTF.gltfExporter.Export () (at Assets/VRM/UniGLTF/Scripts/IO/gltfExporter.cs:138) VRM.VRMExporter._Export (UniGLTF.glTF gltf, VRM.VRMExporter exporter, UnityEngine.GameObject go) (at Assets/VRM/UniVRM/Scripts/Format/VRMExporter.cs:42) VRM.VRMExporter.Export (UnityEngine.GameObject go) (at Assets/VRM/UniVRM/Scripts/Format/VRMExporter.cs:34) VRM.VRMExportSettings.Export (System.String path, System.Collections.Generic.List`1[T] destroy) (at Assets/VRM/UniVRM/Scripts/Format/VRMExportSettings.cs:274) VRM.VRMExportSettings.Export (System.String path) (at Assets/VRM/UniVRM/Scripts/Format/VRMExportSettings.cs:238) VRM.VRMExporterWizard.OnWizardCreate () (at Assets/VRM/UniVRM/Editor/Format/VRMExporterMenu.cs:42) System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at :0) Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation. System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at :0) System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at :0) UnityEditor.ScriptableWizard.OnGUI () (at C:/buildslave/unity/build/Editor/Mono/ScriptableWizard.cs:79) System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at :0) Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation. System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at :0) System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at :0) UnityEditor.HostView.Invoke (System.String methodName, System.Object obj) (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:342) UnityEditor.HostView.Invoke (System.String methodName) (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:336) UnityEditor.HostView.OldOnGUI () (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:129) UnityEngine.Experimental.UIElements.IMGUIContainer.DoOnGUI (UnityEngine.Event evt, UnityEngine.Matrix4x4 worldTransform, UnityEngine.Rect clippingRect, System.Boolean isComputingLayout) (at C:/buildslave/unity/build/Modules/UIElements/IMGUIContainer.cs:266) UnityEngine.Experimental.UIElements.IMGUIContainer.HandleIMGUIEvent (UnityEngine.Event e, UnityEngine.Matrix4x4 worldTransform, UnityEngine.Rect clippingRect) (at C:/buildslave/unity/build/Modules/UIElements/IMGUIContainer.cs:438) UnityEngine.Experimental.UIElements.IMGUIContainer.HandleIMGUIEvent (UnityEngine.Event e) (at C:/buildslave/unity/build/Modules/UIElements/IMGUIContainer.cs:421) UnityEngine.Experimental.UIElements.IMGUIContainer.HandleEvent (UnityEngine.Experimental.UIElements.EventBase evt) (at C:/buildslave/unity/build/Modules/UIElements/IMGUIContainer.cs:401) UnityEngine.Experimental.UIElements.EventDispatcher.ProcessEvent (UnityEngine.Experimental.UIElements.EventBase evt, UnityEngine.Experimental.UIElements.IPanel panel) (at C:/buildslave/unity/build/Modules/UIElements/EventDispatcher.cs:511) UnityEngine.Experimental.UIElements.EventDispatcher.Dispatch (UnityEngine.Experimental.UIElements.EventBase evt, UnityEngine.Experimental.UIElements.IPanel panel, UnityEngine.Experimental.UIElements.DispatchMode dispatchMode) (at C:/buildslave/unity/build/Modules/UIElements/EventDispatcher.cs:307) UnityEngine.Experimental.UIElements.BaseVisualElementPanel.SendEvent (UnityEngine.Experimental.UIElements.EventBase e, UnityEngine.Experimental.UIElements.DispatchMode dispatchMode) (at C:/buildslave/unity/build/Modules/UIElements/Panel.cs:176) UnityEngine.Experimental.UIElements.UIElementsUtility.DoDispatch (UnityEngine.Experimental.UIElements.BaseVisualElementPanel panel) (at C:/buildslave/unity/build/Modules/UIElements/UIElementsUtility.cs:245) UnityEngine.Experimental.UIElements.UIElementsUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr) (at C:/buildslave/unity/build/Modules/UIElements/UIElementsUtility.cs:68) UnityEngine.GUIUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr) (at C:/buildslave/unity/build/Modules/IMGUI/GUIUtility.cs:179)