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

Using pyinstaller misses some files from UnityPy #184

Closed pramberg451 closed 1 year ago

pramberg451 commented 1 year ago

Not sure if this is an issue that directly involves UnityPy but after creating an executable of my UnityPy project with pyinstaller and running it, it exits with the error that it can't find resources/uncompressed.tpk.

astiob commented 1 year ago

You fix this by passing these additional parameters to PyInstaller:

--add-data 'pathToPython/Lib/site-packages/UnityPy/resources/uncompressed.tpk;UnityPy/resources'

or, equivalently, setting this in the spec file:

a = Analysis(
    ...
    datas=[('pathToPython/Lib/site-packages/UnityPy/resources/uncompressed.tpk', 'UnityPy/resources')],
    ...
)

Of course, I assume an official PyInstaller hook could be provided to do this automatically, but to be fair, this isn’t exactly a bug.

pramberg451 commented 1 year ago

Thanks that fixed it for me. I'll close this issue.