if version >= (2022, 2, 0): # 2022.2.0f1 and up
self.m_IgnoreMipmapLimit = reader.read_boolean()
reader.align_stream()
self.m_MipmapLimitGroupName = reader.read_aligned_string()
reader.align_stream()
. . .
if version >= (2022, 2, 0): # 2022.2.0f1 and up
writer.write_boolean(self.m_IgnoreMipmapLimit)
writer.align_stream()
writer.write_aligned_string(self.m_MipmapLimitGroupName)
writer.align_stream()
To fix this I changed the code as follows and it worked:
Example file: https://drive.google.com/file/d/1TyA0H9myZyvk46MYVAVDW_aiu-Cm2miQ/view?usp=sharing
You can see it visually here (I used the same libraries as UnityPy):
https://drive.google.com/file/d/1MZTIq6J_WSYR2IlZELi0rexfxKDO-WCZ/view?usp=sharing