-
-
Notifications
You must be signed in to change notification settings - Fork 701
Open
Labels
waiting for GodotPRs that can't be merged until an engine PR is merged firstPRs that can't be merged until an engine PR is merged first
Description
GDNative:
class MyCustomType : public godot::Node
{
GODOT_CLASS(MyCustomType, godot::Node);
public:
void calling();
void functions();
void works();
void fine();
};
// ...
class Manager: public godot::Node
{
GODOT_CLASS(Manager, godot::Node);
public:
MyCustomType* make_custom_object()
{
auto object = MyCustomType::_new();
add_child(object);
return object;
}
};The .gdns file:
[gd_resource type="NativeScript" load_steps=2 format=2]
[ext_resource path="res://bin/test.gdnlib" type="GDNativeLibrary" id=1]
[resource]
class_name = "MyCustomType"
library = ExtResource( 1 )
script_class_name = "MyCustomType"
GDScript:
var o = Manager.make_custom_object()
o.calling()
o.functions()
o.works()
o.fine()
var test:MyCustomType = o #errorAlso, if the variable is a function parameter, e.g.:
func broken(param:MyCustomType):
pass
# ...
var o = Manager.make_custom_object()
broken(o)...then no runtime error is produced, but param will be null
Metadata
Metadata
Assignees
Labels
waiting for GodotPRs that can't be merged until an engine PR is merged firstPRs that can't be merged until an engine PR is merged first
