K0lb3 / UnityPy

UnityPy is python module that makes it possible to extract/unpack and edit Unity assets
MIT License
771 stars 114 forks source link

1.9.21 breaks loading files with stripped Unity version #158

Closed erikchan002 closed 1 year ago

erikchan002 commented 1 year ago

Code

import UnityPy
UnityPy.config.FALLBACK_UNITY_VERSION = "2020.3.32f1" 
env = UnityPy.load("res001_no001.zip")

Error

Error loading, reverting to EndianBinaryReader:
 'NoneType' object has no attribute 'groups'

Bug This is a regression caused by #157 and does not happen with UnityPy 1.9.20 https://github.com/K0lb3/UnityPy/blob/b7d9f7793bbc34ae6da23ae326e427e6cd48484c/UnityPy/files/BundleFile.py#L95

To Reproduce

K0lb3 commented 1 year ago

Thanks for reporting the issue.

The encryption handling for the CN version added version handling to the BundleFile, which conflicted with the missing version at that point. So, the handling for this case simply had to be ported from the SerializedFile.