Skip to content

Commit 859a362

Browse files
veilmK0lb3
authored andcommitted
tools/extractor.py: only access .path_id and .type.name on object reader
Currently there is an `obj = obj.read()` overwrite that changes the object reader to a direct object, but some other lines still expect the original object reader
1 parent 9cb2a99 commit 859a362

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

UnityPy/tools/extractor.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,12 @@ def export_obj(
5959
return []
6060

6161
if append_name:
62-
fp = os.path.join(fp, obj.m_Name if getattr(obj, "m_Name") else obj.type.name)
62+
fp = os.path.join(fp, obj.m_Name if getattr(obj, "m_Name") else obj.object_reader.type.name)
6363

6464
fp, extension = os.path.splitext(fp)
6565

6666
if append_path_id:
67-
fp = f"{fp}_{obj.path_id}"
67+
fp = f"{fp}_{obj.object_reader.path_id}"
6868

6969
# export
7070
return export_func(obj, fp, extension)
@@ -261,10 +261,10 @@ def exportTexture2D(obj: Texture2D, fp: str, extension: str = ".png") -> List[Tu
261261
if obj.m_Width:
262262
# textures can be empty
263263
obj.image.save(f"{fp}{extension}")
264-
return [(obj.assets_file, obj.path_id)]
264+
return [(obj.assets_file, obj.object_reader.path_id)]
265265

266266
def exportGameObject(obj: GameObject, fp: str, extension: str = "") -> List[Tuple[SerializedFile, int]]:
267-
exported = [(obj.assets_file, obj.path_id)]
267+
exported = [(obj.assets_file, obj.object_reader.path_id)]
268268
refs = crawl_obj(obj)
269269
if refs:
270270
os.makedirs(fp, exist_ok=True)

0 commit comments

Comments
 (0)