You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -73,15 +73,10 @@ In case a new(ish) Python version is used, it can happen that the C-dependencies
73
73
In such cases the user either has to report this as issue or follow the steps of [this issue](https://github.com/K0lb3/UnityPy/issues/223) to compile it oneself.
74
74
Another option for the user is downgrading Python to the latest version supported by UnityPy. For this see the Python version badge at the top of the README.
75
75
76
-
### Crash without warning/error
76
+
####Crash without warning/error
77
77
78
78
The C-implementation of the typetree reader can directly crash Python.
79
-
In case this happens, the usage of the C-typetree reader can be disabled by adding these two lines to your main file.
80
-
81
-
```python
82
-
from UnityPy.helpers import TypeTreeHelper
83
-
TypeTreeHelper.read_typetree_boost =False
84
-
```
79
+
In case this happens, the usage of the C-typetree reader can be disabled. Read [this section](#disable-typetree-c-implementation) for more details.
You probably have to read [Important Classes](#important-classes)
136
131
and [Important Object Types](#important-object-types) to understand how it works.
137
132
138
-
People with slightly advanced Python skills should look at [UnityPy/tools/extractor.py](UnityPy/tools/extractor.py) for a more advanced example.
133
+
Users with slightly advanced Python skills should look at [UnityPy/tools/extractor.py](UnityPy/tools/extractor.py) for a more advanced example.
139
134
It can also be used as a general template or as an importable tool.
140
135
141
-
### Setting the decryption key for Unity CN's AssetBundle encryption
142
-
143
-
The Chinese version of Unity has its own builtin option to encrypt AssetBundles/BundleFiles. As it's a feature of Unity itself, and not a game specific protection, it is included in UnityPy as well.
144
-
To enable encryption simply use `UnityPy.set_assetbundle_decrypt_key(key)`, with key being the value that the game that loads the bundles passes to `AssetBundle.SetAssetBundleDecryptKey`.
145
-
146
136
## Important Classes
147
137
148
138
### Environment
@@ -350,7 +340,7 @@ The samples are converted into the .wav format.
350
340
The sample data is a .wav file in bytes.
351
341
352
342
```python
353
-
clip: AudioClip
343
+
clip: AudioClip
354
344
for name, data in clip.samples.items():
355
345
withopen(name, "wb") as f:
356
346
f.write(data)
@@ -362,7 +352,7 @@ for name, data in clip.samples.items():
362
352
363
353
```python
364
354
if obj.type.name =="Font":
365
-
font: Font = obj.read()
355
+
font: Font = obj.read()
366
356
if font.m_FontData:
367
357
extension =".ttf"
368
358
if font.m_FontData[0:4] ==b"OTTO":
@@ -427,21 +417,69 @@ for obj in env.objects:
427
417
# editing isn't supported yet!
428
418
```
429
419
430
-
## Custom Filesystem
420
+
## Configurations
421
+
422
+
There're several configurations and interfaces that provide the customizability to UnityPy.
423
+
424
+
### Unity CN Decryption
425
+
426
+
The Chinese version of Unity has its own builtin option to encrypt AssetBundles/BundleFiles. As it's a feature of Unity itself, and not a game specific protection, it is included in UnityPy as well.
427
+
To enable encryption simply use the code as follow, with `key` being the value that the game that loads the bundles passes to `AssetBundle.SetAssetBundleDecryptKey`.
428
+
429
+
```python
430
+
import UnityPy
431
+
UnityPy.set_assetbundle_decrypt_key(key)
432
+
```
433
+
434
+
### Unity Fallback Version
435
+
436
+
In case UnityPy failed to detect the Unity version of the game assets, you can set a fallback version. e.g.
437
+
438
+
```python
439
+
import UnityPy.config
440
+
UnityPy.config.FALLBACK_UNITY_VERSION="2.5.0f5"
441
+
```
442
+
443
+
### Disable Typetree C-Implementation
444
+
445
+
The [C-implementation](UnityPyBoost/) of typetree reader can boost the parsing of typetree by a lot. If you want to disable it and use pure Python reader, you can put the following 2 lines in your main file.
446
+
447
+
```python
448
+
from UnityPy.helpers import TypeTreeHelper
449
+
TypeTreeHelper.read_typetree_boost =False
450
+
```
451
+
452
+
### Custom Block (De)compression
453
+
454
+
Some game assets have non-standard compression/decompression algorithm applied on the block data. If you wants to customize the compression/decompression function, you can modify the corresponding function mapping. e.g.
455
+
456
+
```python
457
+
from UnityPy.enums.BundleFile import CompressionFlags
UnityPy uses [fsspec](https://github.com/fsspec/filesystem_spec) under the hood to manage all filesystem interactions.
433
471
This allows using various different types of filesystems without having to change UnityPy's code.
434
472
It also means that you can use your own custom filesystem to e.g. handle indirection via catalog files, load assets on demand from a server, or decrypt files.
435
473
436
474
Following methods of the filesystem have to be implemented for using it in UnityPy.
437
475
438
-
- sep (not a function, just the separator as character)
0 commit comments