Home Game Development c++ – After I inherit my very own GDExtension class, editor can not see the inheriting class

c++ – After I inherit my very own GDExtension class, editor can not see the inheriting class

0
c++ – After I inherit my very own GDExtension class, editor can not see the inheriting class

[ad_1]

I had two lessons in my recreation, Participant and ShootableObject. Each arrange as such:

class Participant : public RigidBody2D
{
personal:
    GDCLASS(Participant, RigidBody2D);
 ... implementation follows ...
class ShootableObject : public RigidBody2D
{
personal:
    GDCLASS(ShootableObject , RigidBody2D);
 ... implementation follows ...

And registered as such in my module:

void initialize_example_module(godot::ModuleInitializationLevel p_level)
{
    if (p_level != godot::MODULE_INITIALIZATION_LEVEL_SCENE)
    {
        return;
    }
    godot::ClassDB::register_class<godot::Participant>();
    godot::ClassDB::register_class<godot::ShootableObject>();
}

I wished to extract some widespread conduct from the 2 and created a 3rd class, as such:

class GravityBody2D : public RigidBody2D
{
personal:
    GDCLASS(GravityBody2D, RigidBody2D);

I then modified the inheritance of the opposite two:

class Participant : public GravityBody2D
{
personal:
    GDCLASS(Participant, GravityBody2D);
 ... implementation follows ...

And added it to the exports:

void initialize_example_module(godot::ModuleInitializationLevel p_level)
{
    if (p_level != godot::MODULE_INITIALIZATION_LEVEL_SCENE)
    {
        return;
    }
    godot::ClassDB::register_class<godot::Participant>();
    godot::ClassDB::register_class<godot::ShootableObject>();
    godot::ClassDB::register_class<godot::GravityBody2D>();
}

I now get an error that the lessons will not be discovered:

  Can not get class 'Participant'.
  Can not get class 'ShootableObject'.
  Can not get class 'ShootableObject'.

I can nevertheless see GravityBody2D within the node record:

enter image description here

How can I inherit my very own class?

[ad_2]

Previous article Attractive Anime RPG Forces Gamers To Grind To Escape ‘Gem Debt’
Next article BlizzCon 2023 Opening Ceremony recap
Hello there! My name is YoleeTeam, and I am thrilled to welcome you to AmazonianGames.com. As the premier destination for all things related to Amazon Games' universe, we are dedicated to providing you with the most exciting and immersive gaming experiences out there. From captivating visuals to exhilarating gameplay, our website is packed with comprehensive insights, updates, and reviews to keep you ahead of the game. Whether you're a seasoned gamer or new to the scene, I am here to guide you through this virtual frontier. If you have any questions or suggestions, feel free to reach out to me at john@yoleesolutions.com. Embark on your Amazon gaming journey today with AmazonianGames.com and let the adventure begin!