![]() |
Attention | Topic was automatically imported from the old Question2Answer platform. |
![]() |
Asked By | shashank96 |
I have a shader material created and saved as .gdshader. I want to apply this shader as a material to my MeshInstance. To do this I have the following code:
public Resource blueprintShader = ResourceLoader.Load("res://BuildingBlueprint.shader");
var materialCount = this.model.GetSurfaceMaterialCount();
for (var c = 0; c < materialCount; c++) {
this.model.SetSurfaceMaterial(c, null);
// this.model.SetSurfaceMaterial(c, blueprintShader);
}
The issue is, I am not understanding what type should the preloaded shader be? The SetSurfaceMaterial() method takes in a ‘Material’ type only.
Also is there any other way of apply shaders which might be easier to do?