K0lb3 / UnityPy

UnityPy is python module that makes it possible to extract/unpack and edit Unity assets

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

.save_typetree() MonoBehaviour function not working.

AcidicPeridot opened this issue · comments

Code

for obj in data.objects:
    if obj.type.name == "MonoBehaviour" and obj.read_typetree()["m_Name"] == item.replace(".json", ""):
        tree = script
        obj.save_typetree(tree)
        continue

Error
No error.

Bug
Here's a script that helps me export/import event scripts from a mobile game. This exact code has worked in the past, but I've adjusted some thing in my ecosystem of scripts for this particular game to save me quite a bit of time, but now the script saving part doesn't want to cooperate it seems. I have a dictionary grabbed from a JSON file on disk, saved as "script", which is a modified version of the MonoBehaviour object's typetree called in the asset bundle. The asset opens fine, the typetree reads fine (all the data is correct from obj.read_typetree) and it can save the asset fine, obj.save_typetree just doesn't do anything.

To Reproduce

  • Python 3.12.0
  • UnityPy 1.10.12
  • This asset bundle
  • Set fallback Unity version to "2020.3.32f1"