K0lb3 / UnityPy

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

Fix SerializedType dependency count on write #256

Closed mmatyas closed 1 month ago

mmatyas commented 1 month ago

When reading the types from a version 21+ asset, UnityPy correctly reads the type tree, then correctly reads the list of dependencies as a regular "count + elements" array.

However, when writing the type tree, UnityPy writes a fixed 0x0 in place of the dependency array length, then writes the array without a count field (with write_length being False by default). This results a corrupted file when a type actually has dependencies.

K0lb3 commented 1 month ago

Thanks for noticing and fixing the problem.