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
The structure/typetree for these classes might not be contained in the asset files.
279
+
In such cases see the 2nd example (TypeTreeGenerator) below.
276
280
277
281
-`.m_Name`
278
282
-`.m_Script`
@@ -303,6 +307,39 @@ for obj in env.objects:
303
307
data.save(raw_data= f.read())
304
308
```
305
309
310
+
**TypeTreeGenerator**
311
+
312
+
UnityPy can generate the typetrees of MonoBehaviours from the game assemblies using an optional package, ``TypeTreeGeneratorAPI``, which has to be installed via pip.
313
+
UnityPy will automatically try to generate the typetree of MonoBehaviours if the typetree is missing in the assets and ``env.typetree_generator`` is set.
314
+
315
+
```py
316
+
import UnityPy
317
+
from UnityPy.helpers.TypeTreeGenerator import TypeTreeGenerator
318
+
319
+
# create generator
320
+
GAME_ROOT_DIR: str
321
+
# e.g. r"D:\Program Files (x86)\Steam\steamapps\common\Aethermancer Demo"
322
+
GAME_UNITY_VERSION: str
323
+
# you can get the version via an object
324
+
# e.g. objects[0].assets_file.unity_version
325
+
326
+
generator = TypeTreeGenerator(GAME_UNITY_VERSION)
327
+
generator.load_local_game(GAME_ROOT_DIR)
328
+
# generator.load_local_game(root_dir: str) - for a Windows game
329
+
# generator.load_dll_folder(dll_dir: str) - for mono / non-il2cpp or generated dummies
0 commit comments