|Topic was automatically imported from the old Question2Answer platform.
I’ve got a 3d model with many meshes which I originally imported with glTF (with materials) and set as a scene. I decided to change one of the many MeshInstances so, to avoid starting from scratch, I made a new model for the mesh in question, exported from blender as a obj and added that as a mesh (ArrayMesh) to the relevant MeshInstance. The new mesh has three surface materials. I made new materials in Material Maker, added them manually and converted them to ShaderMaterial.
Even though the mesh’s surface materials are ShaderMaterial in the editor (and in Remote during runtime) and are rendered as the desired ShaderMaterial in the game, when addressed in code it returns as a SpatialMaterial.
That is to say:
obj.mesh.surface_get_material(0).set_shader_param("foo", true) throws an error, no function
set_shader_param on SpatialMaterial.
I’m certain I’m addressing the right object.
Reimporting the mesh / making a new MeshInstance node / making the shader material unique and saving it. It always remains a Spatial when addressed in code but appears as Shader in editor.
Is either the
.glTF file somehow acting in the background here but only in code?
Anyone know what’s going on?