@@ -69,7 +69,7 @@ def unpack_all_assets(source_folder : str, destination_folder : str):
6969 # iterate over internal objects
7070 for obj in env.objects:
7171 # process specific object types
72- if obj.type in [" Texture2D" , " Sprite" ]:
72+ if obj.type.name in [" Texture2D" , " Sprite" ]:
7373 # parse the object data
7474 data = obj.read()
7575
@@ -86,7 +86,7 @@ def unpack_all_assets(source_folder : str, destination_folder : str):
8686
8787 # alternative way which keeps the original path
8888 for path,obj in env.container.items():
89- if obj.type in [" Texture2D" , " Sprite" ]:
89+ if obj.type.name in [" Texture2D" , " Sprite" ]:
9090 data = obj.read()
9191 # create dest based on original path
9292 dest = os.path.join(destination_folder, * path.split(" /" ))
@@ -176,7 +176,7 @@ __Export__
176176``` python
177177from PIL import Image
178178for obj in env.objects:
179- if obj.type == " Texture2D" :
179+ if obj.type.name == " Texture2D" :
180180 # export texture
181181 data = image.read()
182182 data.image.save(path)
@@ -200,7 +200,7 @@ Unlike most other extractors (including AssetStudio) UnityPy merges those two im
200200__ Export__
201201``` python
202202for obj in env.objects:
203- if obj.type == " Sprite" :
203+ if obj.type.name == " Sprite" :
204204 data = image.read()
205205 data.image.save(path)
206206```
@@ -218,7 +218,7 @@ Some games save binary data as TextFile, so it's usually better to use ``.script
218218__ Export__
219219``` python
220220for obj in env.objects:
221- if obj.type == " TextAsset" :
221+ if obj.type.name == " TextAsset" :
222222 # export asset
223223 data = image.read()
224224 with open (path, " wb" ) as f:
@@ -246,7 +246,7 @@ __Export__
246246import json
247247
248248for obj in env.objects:
249- if obj.type == " MonoBehaviour" :
249+ if obj.type.name == " MonoBehaviour" :
250250 # export
251251 if obj.serialized_type.nodes:
252252 # save decoded data
@@ -301,7 +301,7 @@ with open(f"{mesh.name}.obj", "wt", newline = "") as f:
301301### [ Font] ( UnityPy/classes/Font.py )
302302
303303``` python
304- if obj.type == " Font" :
304+ if obj.type.name == " Font" :
305305 font : Font = obj.read()
306306 if font.m_FontData:
307307 extension = " .ttf"
0 commit comments