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

saving error #265

Closed 1areeg closed 3 weeks ago

1areeg commented 3 weeks ago

Code

for obj in env.objects: if obj.type.name == "Texture2D": #print(obj.read().name) if obj.read().name == "ShopBGBase02": data = obj.read() data.image = Image.open("backgrounds/temp/temp.png") data.save() break with open("../data.unity3d", "wb") as f: f.write(env.file.save())

Error The error message that is produced by python. line 49, in <module> f.write(env.file.save()) ^^^^^^^^^^^^^ AttributeError: 'EndianBinaryReader_Streamable_BigEndian' object has no attribute 'save'

Bug it should save the unitydata file.

To Reproduce

JunkBeat commented 3 weeks ago

try this:

f.write(env.file.bytes)
1areeg commented 3 weeks ago

Wow, thank you very much. It worked perfectly.