Hello guys,
My workflow is as follows:
- Write Haxe code in an external editor.
- Compile Haxe code with hxdefold, which generates .script files.
- Use .script files in Defold.
And I have an on_build_started hook which runs the Haxe compiler, so for the most part it works fine, I only need to run the game in the editor. However I’m dealing with this annoying thing where changes to scripts need a second run in order to be reloaded, as you can see in the gif below.
As you can see, I add a line to the character’s script so that he deletes himself, but it only comes into effect the second time I run the game. I have also confirmed that the hook runs and compiles Haxe on the first run, the generated lua already has the deletion line.
Also, if I disable the editor hooks script and build my Haxe outside of Defold before running, the problem becomes sporadic. Sometimes script changes will have effect immediately and sometimes they won’t.
My hooks.editor_script:
local M = {}
function M.on_build_started(opts)
return {
{
action = "shell",
command = { "haxe", "build.hxml" }
}
}
end
return M