K0lb3 / UnityPy

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

Bug withTexture2DConverter #238

Open AXiX-official opened 1 month ago

AXiX-official commented 1 month ago

Code

if __name__ == "__main__":
    filename = "22"
    env = UnityPy.load(f"assetbundles/{filename}")
    for obj in env.objects:
        if obj.type.name == "Texture2D":
            data = obj.read()
            # data.image.save(f"workspace/mod/{filename}.png")
            img = Image.open(f"workspace/mod/{filename}.png")
            data.set_image(img)
            data.save()
            break
    with open(f"workspace/mod/{filename}u", "wb") as f:
        f.write(env.file.save(packer="none"))

Error No error message.

Bug When I work with a series of textures in ETC2_RGBA8 format, 192*256 size, the texture in the modified file becomes blurry, however, there is no problem for other textures that are also in ETC2_RGBA8 format, but in different sizes.

To Reproduce