{"id":24790,"library":"unitypy","title":"UnityPy","description":"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.","status":"active","version":"1.25.0","language":"python","source_language":"en","source_url":"https://github.com/K0lb3/UnityPy","tags":["unity","asset extraction","modding","asset bundle","gamedev"],"install":[{"cmd":"pip install unitypy","lang":"bash","label":"Latest stable"}],"dependencies":[{"reason":"Decompression of Unity LZ4 blocks","package":"lz4","optional":false},{"reason":"Texture decoding and encoding (PNG, JPEG, etc.)","package":"Pillow","optional":false},{"reason":"AES decryption for encrypted bundles","package":"pycryptodome","optional":true},{"reason":"Runtime type checking used internally","package":"typeguard","optional":false}],"imports":[{"note":"AssetsManager is at top level since v1.5.0","wrong":"from UnityPy.environment import AssetsManager","symbol":"AssetsManager","correct":"from UnityPy import AssetsManager"},{"note":"File class is at top level since v1.15.0","wrong":"from UnityPy.files import File","symbol":"File","correct":"from UnityPy import File"},{"note":"Environment is at top level since v1.0.0","wrong":"from UnityPy.environment import Environment","symbol":"Environment","correct":"from UnityPy import Environment"}],"quickstart":{"code":"from UnityPy import AssetsManager\nimport os\n\nenv = AssetsManager()\n# Load a Unity asset bundle file\nenv.load_file('example.bundle')\nfor asset in env.assets:\n    for obj in asset.objects:\n        # Check object type\n        if obj.type.name == 'Texture2D':\n            data = obj.read()\n            # Save as PNG\n            data.image.save('output.png', 'PNG')\n            break\n","lang":"python","description":"Load an asset bundle, read all objects, and export first Texture2D as PNG."},"warnings":[{"fix":"Always instantiate AssetsManager (or Environment) and use its load_file method.","message":"The AssetsManager must be created before loading files. Loading files directly with File class without an environment may cause missing dependencies or incomplete asset graph.","severity":"gotcha","affected_versions":">=1.0"},{"fix":"After setting properties, call obj.save() and then env.pack() before writing the output file.","message":"When modifying assets, you must call obj.save() on each changed object and then environment.pack() to rebuild the bundle. Failure to do so results in lost changes.","severity":"gotcha","affected_versions":">=1.0"},{"fix":"Use 'from UnityPy import File' instead of 'from UnityPy.files import File'.","message":"In version 1.15.0, the File class was moved from UnityPy.files to UnityPy directly. Old imports will break.","severity":"breaking","affected_versions":"<1.15.0"},{"fix":"Always call obj.read() to deserialize the object data.","message":"Reading object properties requires calling obj.read() before accessing data. Otherwise, you get empty or None values.","severity":"gotcha","affected_versions":">=1.0"},{"fix":"Use AssetsManager instead of Environment.","message":"The Environment class is deprecated in favor of AssetsManager since version 1.20.0. It may be removed in the future.","severity":"deprecated","affected_versions":">=1.20.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Run 'pip install unitypy' in your active Python environment.","cause":"UnityPy is not installed or is installed in a different environment.","error":"ModuleNotFoundError: No module named 'UnityPy'"},{"fix":"Ensure you have at least version 1.5.0: 'pip install unitypy>=1.5.0' and use 'from UnityPy import AssetsManager'.","cause":"Old import path used or outdated version (<1.5.0).","error":"AttributeError: module 'UnityPy' has no attribute 'AssetsManager'"},{"fix":"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)","cause":"Trying to access a type name that doesn't exist in the loaded bundle.","error":"KeyError: 'Texture2D'"},{"fix":"Verify the bundle is valid. Try using lz4 version 4.0.2+. If the bundle uses block compression, upgrade UnityPy and lz4.","cause":"Corrupt or unsupported compression settings in the asset bundle.","error":"lz4.error.LZ4F_error_decompression"},{"fix":"Provide the correct encryption key via AssetsManager(key=your_key). If not set, the library may try default keys.","cause":"Encryption key mismatch for decryption.","error":"cryptodome.CryptoError: Wrong key"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}