Skip to content

Commit 87a46fd

Browse files
committed
fix(MeshHelper): detect m_Use16BitIndices for version >= 2017,3
1 parent 6979baa commit 87a46fd

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

UnityPy/helpers/MeshHelper.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,8 +166,16 @@ def process(self):
166166

167167
# try to copy data directly from mesh
168168
if isinstance(mesh, Mesh):
169-
if mesh.m_Use16BitIndices is False:
170-
self.m_Use16BitIndices = False
169+
if mesh.m_Use16BitIndices is not None:
170+
self.m_Use16BitIndices = bool(mesh.m_Use16BitIndices)
171+
elif (
172+
self.version >= (2017, 4)
173+
or
174+
# version == (2017, 3, 1) & patched - px string
175+
self.version[:2] == (2017, 3)
176+
and mesh.m_MeshCompression == 0
177+
):
178+
self.m_Use16BitIndices = mesh.m_IndexFormat == 0
171179
self.copy_from_mesh()
172180
elif isinstance(mesh, SpriteRenderData):
173181
self.copy_from_spriterenderdata()

0 commit comments

Comments
 (0)