diff --git a/Assets/VRM10/vrmlib/Runtime/BufferAccessor.cs b/Assets/VRM10/vrmlib/Runtime/BufferAccessor.cs index 47a4ed3d1..f85e8553d 100644 --- a/Assets/VRM10/vrmlib/Runtime/BufferAccessor.cs +++ b/Assets/VRM10/vrmlib/Runtime/BufferAccessor.cs @@ -122,7 +122,20 @@ namespace VrmLib } else { - throw new Exception($"Stride:{Stride}!= sizeof({typeof(T).Name}:{Marshal.SizeOf(typeof(T))}"); + if (typeof(T) == typeof(SkinJoints) && Stride == 4) + { + // 例えば SkinJoints を使う JOINTS_0 は UNSIGNED_BYTE と UNSIGNED_SHORT の2種類がありえる。 + fixed (UShort4* p = GetAsUShort4()) + { + var nativeArray = new NativeArray(Count, allocator); + UnsafeUtility.MemCpy(nativeArray.GetUnsafePtr(), p, Bytes.Count); + return nativeArray; + } + } + else + { + throw new Exception($"Stride:{Stride}!= sizeof({typeof(T).Name}:{Marshal.SizeOf(typeof(T))}"); + } } }