Skip to content

Commit 3159b5b

Browse files
authored
Update README.md
1 parent b8548c1 commit 3159b5b

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -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
177177
from PIL import Image
178178
for 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
202202
for 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
220220
for 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__
246246
import json
247247

248248
for 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

Comments
 (0)