0 votes

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.

asked Feb 18 in Engine by monnef (17 points)

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.