Can we use MultiMeshInstance3D in code ?

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

i have terrain generated with algorithm at run time. Can i genrated grass with MultiMeshInstance3d on my tileset after that is loaded ?

:bust_in_silhouette: Reply From: zhyrin

The scene tree and the editor are a convenience for building levels, but you can do it all from code. You can create a MultiMeshInstance3D node in code, assing a MultiMesh resource to it created in code. Make sure you initialize and update the values correctly.
One caveat is that if you want to save it to disk, you not only have to add it to the scene tree, you’ll also have to set the owner property of your MultiMeshInstance3D.