You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Can't set material rid of inherited material class #1883
I'm currently developing a custom material type that inherits directly from the material class. My problem is that the get_rid and get_material methods are always returns a null RID. Even if I override _get_rid, it remains unchanged.
I investigated a bit more closely and it seems that the set_material method of the Material class is missing within the engine in the C++ bindings.
This seems to be a problem in GDScript as well.
I thought it was possible, since the documentary claims this: Importantly, you can inherit from Material to create your own custom material type in script or in GDExtension.
Steps to reproduce
Create a new C++ Class and inherit from Material
Create a new material using godot::RenderingServer::get_singleton()->material_create(); and set a shader using godot::RenderingServer::get_singleton()->material_set_shader(m_MaterialRid, Shader);
Overwrite godot::RID _get_rid() const and return the RID, which was created using material_create.
Try to set a uniform variable godot::RenderingServer::get_singleton()->material_set_param(get_rid(), "metallic", 2.0); or godot::RenderingServer::get_singleton()->material_set_param(get_rid(), "metallic", 2.0);
You will get an error message, that the RID is null.
Activity
sse-evn commentedon Nov 30, 2025
😁