Skip to content

Instantly share code, notes, and snippets.

@tsraveling
Created May 9, 2023 13:56
Show Gist options
  • Save tsraveling/5ebbe16759efce8892dacacab2529f14 to your computer and use it in GitHub Desktop.
Save tsraveling/5ebbe16759efce8892dacacab2529f14 to your computer and use it in GitHub Desktop.
RefCounted objects Godot C++

Class definition:

#include <godot_cpp/core/binder_common.hpp> // This appears to have a lot of features included right here


class ExampleRef : public RefCounted {
	GDCLASS(ExampleRef, RefCounted);

private:
	// ...

protected:
	static void _bind_methods();

public:
	ExampleRef();
	~ExampleRef();
};

To instantiate:

Ref<ExampleRef> ref;
ref.instantiate();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment