Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | monnef |
My most promising attempt:
register_property<CPP, Ref<Material>>("material", &CPP::set_material, &CPP::get_material,
Ref<Material>(nullptr),
GODOT_METHOD_RPC_MODE_DISABLED, GODOT_PROPERTY_USAGE_DEFAULT,
GODOT_PROPERTY_HINT_RESOURCE_TYPE,
"SpatialMaterial,ShaderMaterial");
void CPP::set_material(Ref<Material> mat) { material = mat; }
Ref<Material> CPP::get_material() { return material; }
I tried many variations, it either ends with a property being locked in the editor (showing [null]
and cannot be changed), or with editor crashing after opening the project.