env = UnityPy.load(bundle_file)
for obj in env.objects:
if obj.type.name != 'MonoBehaviour':
continue
if not obj.serialized_type.nodes:
logging.warning('bundle: object does not have any nodes!')
continue
tree = obj.read_typetree()
Error
tree = obj.read_typetree()
^^^^^^^^^^^^^^^^^^^
File "site-packages\UnityPy\files\ObjectReader.py", line 219, in read_typetree
res = TypeTreeHelper.read_typetree(nodes, self)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "site-packages\UnityPy\helpers\TypeTreeHelper.py", line 156, in read_typetree
return read_typetree_c(
^^^^^^^^^^^^^^^^
ValueError: Can't read 1445199970 bytes at position 236 of 312
Error occured at UnityPyBoost/TypeTreeHelper.c:274:read_string
Almost exact error occurs if TypeTreeHelper.read_typetree_c = False is used:
tree = obj.read_typetree()
^^^^^^^^^^^^^^^^^^^
File "site-packages\UnityPy\files\ObjectReader.py", line 219, in read_typetree
res = TypeTreeHelper.read_typetree(nodes, self)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "site-packages\UnityPy\helpers\TypeTreeHelper.py", line 167, in read_typetree
raise TypeTreeError(
UnityPy.exceptions.TypeTreeError: Error while read type, read 260 bytes but expected 312 bytes
Bug
I have 2 bundles with text assets; one is working fine, the other causes exceptions during obj.read_typetree() call. If I ignore these exceptions while reading - it seems to extract most of the bundle contents just fine. However if I then try to edit the contents and save the bundle, the resulting file causes the game to freeze on startup, and cannot be opened with AssetStudio for example.
Code
Error
Almost exact error occurs if
TypeTreeHelper.read_typetree_c = False
is used:Bug I have 2 bundles with text assets; one is working fine, the other causes exceptions during
obj.read_typetree()
call. If I ignore these exceptions while reading - it seems to extract most of the bundle contents just fine. However if I then try to edit the contents and save the bundle, the resulting file causes the game to freeze on startup, and cannot be opened with AssetStudio for example.To Reproduce