Script hook doesn't work after exporting mod

Godot Version

Godot_v4.3-stable_win64

Question

I’m writing a mod for a Steam game. I use Script Hook to modify a vanilla function in a global class. According to the tutorial here:

I use the mod tool file system context menu to convert the vanilla script file to hooked version and it works well.


If I don’t convert the vanilla file, the hook doesn’t work in the editor, which means the game developer hasn’t enabled the Mod Hook in the original game file. So it’s not surprising that the hook function doesn’t work when I test my exported .zip mod file, since the original file is not converted.

How can I make the hook works in exported mod? I export my mod using the Mod Tool, did I do something wrong? If no, is there any other way to export my mod to keep the hook function working? Or is there any other method to modify the function in global class?

Thanks for your help.

Still don’t know how to mod a function in a global class. But for my problem, I finally find a way to achieve the same function I want in my mod by modifiying some other functions in the non-global class, using Script Extension. This may be the current solution. Hopefully Script Extension that support global class will be updated in the future.