How to load textures to spatial material (via GScript)

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

Hello everyone!

Sorry if I’m asking basic stuff, but searching web yielded either no results or results that doesn’t work.

I have a mesh nodes in scene tree, and I would like to change albedo texture via code. I somehow fail to reference material: if mesh_instance_node.material_override will always return false.

I tried to create spatial material in Material section of mesh inspector and I tried to create that same material in Surface 1 section - both cases returned false.

So, to sum up - there is mesh node with existing material. I can’t change albedo texture via GScript.

Any help is much appreciated.