A Python library for extracting and patching Unity assets (AssetBundle, SerializedFile, etc.). It supports reading and modifying Unity assets from Unity 4.x to 2022.x. Current version 1.25.0, requires Python >=3.8, MIT license. Active development, frequent releases.
pip install unitypyVerified import paths — ran on the pinned version, not inferred.
Load an asset bundle, read all objects, and export first Texture2D as PNG.
Always instantiate AssetsManager (or Environment) and use its load_file method.
After setting properties, call obj.save() and then env.pack() before writing the output file.
Use 'from UnityPy import File' instead of 'from UnityPy.files import File'.
Always call obj.read() to deserialize the object data.
Use AssetsManager instead of Environment.
Run 'pip install unitypy' in your active Python environment.
Ensure you have at least version 1.5.0: 'pip install unitypy>=1.5.0' and use 'from UnityPy import AssetsManager'.
Check the type via obj.type.name or iterate over all objects to find the correct type. Use a loop: for obj in asset.objects: print(obj.type.name)
Verify the bundle is valid. Try using lz4 version 4.0.2+. If the bundle uses block compression, upgrade UnityPy and lz4.
Provide the correct encryption key via AssetsManager(key=your_key). If not set, the library may try default keys.