Adding a mesh generated by SurfaceTool to my scene

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By jwadden

I’m following the tutorial in the main documentation regarding creating geometry with the SurfaceTool, and the example code ends with

var mesh = st.commit()

This generates a “mesh” variable with the results of the data entered into the SurfaceTool, but what can I do with this variable afterwards? When I try to call add_child() on it I get the following error:

Invalid type in function 'add_child' in base 'Spatial ('. Cannot convert argument 1 from Object to Object.

Did you solve this?

Seems to me that you can save the ArrayMesh into a .tres file, which can be imported into your scene using a ImporterMeshInstance3D?

Using the ArrayMesh — Godot Engine (latest) documentation in English

ImporterMeshInstance3D — Godot Engine (latest) documentation in English

Gatada | 2022-09-12 22:40