VRMConverterForVRChat icon indicating copy to clipboard operation
VRMConverterForVRChat copied to clipboard

PhysBone やDB が入っていないアバタで例外が発生する

Open azwjp opened this issue 2 years ago • 4 comments

PhysBone 等が一切入っていないアバタでは VRMSpringBone の ColliderGroups が null になっているため,以下のように NullReferenceException が発生します. (このときも,VRMSpringBone は GetComponentsInChilderen() で取得できます)

System.NullReferenceException: Object reference not set to an instance of an object
  at System.Linq.Enumerable+SelectManySingleSelectorIterator`2[TSource,TResult].MoveNext () [0x0005e] in <351e49e2a5bf4fd6beabb458ce2255f3>:0 
  at System.Linq.Enumerable+SelectEnumerableIterator`2[TSource,TResult].ToArray () [0x00030] in <351e49e2a5bf4fd6beabb458ce2255f3>:0 
  at System.Linq.Enumerable.ToArray[TSource] (System.Collections.Generic.IEnumerable`1[T] source) [0x0001f] in <351e49e2a5bf4fd6beabb458ce2255f3>:0 
  at Esperecyan.Unity.VRMConverterForVRChat.VRChatToVRM.VRChatToVRMConverter.RemoveUnusedColliderGroups (UnityEngine.GameObject instance) [0x00035] in D:\Workspace\vr\VRCToolTest\Library\PackageCache\[email protected]\Editor\VRChatToVRM\VRChatToVRMConverter.cs:335 
  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) [0x00239] in D:\Workspace\vr\VRCToolTest\Library\PackageCache\[email protected]\Editor\VRChatToVRM\VRChatToVRMConverter.cs:187 
  at Esperecyan.Unity.VRMConverterForVRChat.UI.VRChatToVRMWizard.OnWizardCreate () [0x001c4] in D:\Workspace\vr\VRCToolTest\Library\PackageCache\[email protected]\Editor\UI\VRChatToVRMWizard.cs:292 
  at (wrapper managed-to-native) System.Reflection.MonoMethod.InternalInvoke(System.Reflection.MonoMethod,object,object[],System.Exception&)
  at System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00032] in <eae584ce26bc40229c1b1aa476bfa589>:0 
  at System.Linq.Enumerable+SelectManySingleSelectorIterator`2[TSource,TResult].MoveNext () [0x0005e] in <351e49e2a5bf4fd6beabb458ce2255f3>:0 
  at System.Linq.Enumerable+SelectEnumerableIterator`2[TSource,TResult].ToArray () [0x00030] in <351e49e2a5bf4fd6beabb458ce2255f3>:0 
  at System.Linq.Enumerable.ToArray[TSource] (System.Collections.Generic.IEnumerable`1[T] source) [0x0001f] in <351e49e2a5bf4fd6beabb458ce2255f3>:0 
  at Esperecyan.Unity.VRMConverterForVRChat.VRChatToVRM.VRChatToVRMConverter.RemoveUnusedColliderGroups (UnityEngine.GameObject instance) [0x00035] in D:\Workspace\vr\VRCToolTest\Library\PackageCache\[email protected]\Editor\VRChatToVRM\VRChatToVRMConverter.cs:335 
  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) [0x00239] in D:\Workspace\vr\VRCToolTest\Library\PackageCache\[email protected]\Editor\VRChatToVRM\VRChatToVRMConverter.cs:187 
  at Esperecyan.Unity.VRMConverterForVRChat.UI.VRChatToVRMWizard.OnWizardCreate () [0x001c4] in D:\Workspace\vr\VRCToolTest\Library\PackageCache\[email protected]\Editor\UI\VRChatToVRMWizard.cs:292 
  at (wrapper managed-to-native) System.Reflection.MonoMethod.InternalInvoke(System.Reflection.MonoMethod,object,object[],System.Exception&)
  at System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00032] in <eae584ce26bc40229c1b1aa476bfa589>:0 

azwjp avatar Jun 21 '22 14:06 azwjp

PR だしました https://github.com/esperecyan/VRMConverterForVRChat/pull/42

azwjp avatar Jun 21 '22 14:06 azwjp

ご報告ありがとうございます。 こちらでは問題を再現できませんでした。 変換元が存在しなければGetComponentsInChildrenは空の配列になるので例外が発生することはなさそうなのですが、こちらの問題が発生する条件は他にありますか?

esperecyan avatar Jun 26 '22 05:06 esperecyan

GetComponentsInChildren で VRMSpringBone 自体はとれるのですが,springBone.ColliderGroups が null になっている状態でした. 発生条件についてもうすこし確認してみます.

azwjp avatar Jun 26 '22 05:06 azwjp

VRMへの変換時に発生したとのツイートあり。 https://twitter.com/Flan5615/status/1572864089717903360

VRChatアバターにVRMSpringBoneが混在しているとき、その組み合わせによっては問題が発生する?

esperecyan avatar Sep 23 '22 07:09 esperecyan