Skip to content

Commit f813f6c

Browse files
AhmedAhmedEGK0lb3
andauthored
AttributeError: 'EndianBinaryReader_Memoryview_BigEndian' object has no attribute 'is_changed' (#185)
* Update environment.py Fixed a bug where Enviroment.save() function was always assuming all asset objects have the "is_changed" attributes, causing it to raise an exception if it encountered an "EndianBinaryReader_Memoryview_BigEndian" object, as that object doesn't have an "is_changed" attribute. * Fix indent and use getattribute * env-save: Use fname and fitem --------- Co-authored-by: Rudolf Kolbe <[email protected]>
1 parent 7fff866 commit f813f6c

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

UnityPy/environment.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -152,12 +152,12 @@ def save(self, pack="none"):
152152
Mark assets as changed using `.mark_changed()`.
153153
pack = "none" (default) or "lz4"
154154
"""
155-
for f in self.files:
156-
if self.files[f].is_changed:
155+
for fname, fitem in self.files.items():
156+
if getattr(fitem, "is_changed", False):
157157
with open(
158-
os.path.join(self.out_path, os.path.basename(f)), "wb"
158+
os.path.join(self.out_path, os.path.basename(fname)), "wb"
159159
) as out:
160-
out.write(self.files[f].save(packer=pack))
160+
out.write(fitem.save(packer=pack))
161161

162162
@property
163163
def objects(self) -> List[ObjectReader]:

0 commit comments

Comments
 (0)