Editor script "editing game objects" examples seem incorrect

The documentation and examples for editor scripts, especially all the stringly-typed stuff, is pretty sparse. I’m muddling through a script right now to build convex hull collision objects for tilemaps, and I’ve run into these errors that seem to contradict the docs:

ERROR:EXT: Create collision hulls's "run" in /main/levels/level_tiles.editor_script failed: /main/levels/level_tiles.editor_script:178 EmbeddedGOInstanceNode does not define "components"
ERROR:EXT: Create collision hulls's "run" in /main/levels/level_tiles.editor_script failed: /main/levels/level_tiles.editor_script:178 ReferencedGOInstanceNode does not define "components"

Initially I thought maybe it was due to using an embedded GO, so I extracted it, but as you can see both types of game object yield the same error. This is when trying to execute code based on Editor scripts, specifically this example:

editor.tx.add("/npc.go", "components", {
        type = "collisionobject",
        id = "collision",
        shapes = {
            {
                type = "shape-type-box",
                dimensions = {32, 32, 32}
            }
        }
    }),

The line that’s failing is:

editor.tx.add(go_node, "components", {
        type = "collisionobject",
        id = component_id,
        collision_shape = file_path,
    })

go_node is an entry in opts.selection.

Has the mechanism for adding a “collisionobject” component to a game object node changed from how it’s documented?

Thanks!

It has not changed as far as I know. Which version of Defold are you using? This functionality was added in Defold 1.10.3.

I’m also using 1.10.3. I created a minimal project to test just this issue and it appears there as well, so I opened an issue in github:

Apparently this feature won’t be available until 1.10.4 - tested on the pre-release of that version and everything works great!

1 Like

Oh, sorry, I confused the versions in that case. The beta is released now btw.

1 Like