How can I apply a SpatialMaterial to a CubeMesh via GDscript?

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

Title says it all.
I’ve figured out how to Apply a SpatialMaterial to a MeshInstance, but I need it applied directly to the mesh for inclusion in a meshlibrary for use with gridmaps.

Alternatively if there’s a way to edit the properties of a material on a loaded CubeMesh instead I’d love to hear it.

:bust_in_silhouette: Reply From: Spikmin

To answer my own question albeit with great shame; Mesh.surface_set_material() is the function I was looking for, as opposed to Mesh.set_surface_ material()which is the syntax for MeshInstances.

SYNTAX IS EVERYTHING PEOPLE