Godot Version
4.1.4
Issue
Currently when developing extensions I have issues testing them as my editor often crashes when I open a project which imports them. Because of these crashes I never get any error messages hinting what might be the problem.
I am also a bit confused because all I am doing is creating basic extensions with getter/setter and bind their corresponding properties. I did this multiple times before without any issues.
In addition these crashes seem to occur randomly as before I was able to succesfully start my editor and import my extension node when commenting out the _bind_methods() code. This does not work anymore.
Question
Does anyone know how to fix this issue? Is there any way to get at least some error messages?
Code
This is the current extension code I struggle to import. One time it worked. Now it doesn’t anymore:
DefaultJump.h
#ifndef DEFAULT_JUMP
#define DEFAULT_JUMP
#include <CharacterComponent.h>
#include <godot_cpp/variant/string_name.hpp>
namespace godot {
class DefaultJump : public CharacterComponent {
GDCLASS(DefaultJump, CharacterComponent)
private:
StringName jump_action_strg;
float jump_velocity;
protected:
static void _bind_methods();
public:
DefaultJump();
~DefaultJump();
//void _physics_process(double delta);
StringName get_JumpActionString() const;
void set_JumpActionString(const StringName &jmp_strg);
float get_JumpVelocity() const;
void set_JumpVelocity(float jmp_vlc);
};
}
#endif
DefaultJump.cpp
#include "DefaultJump.h"
#include <CharacterComponent.h>
#include <godot_cpp/classes/engine.hpp>
#include <godot_cpp/variant/string.hpp>
#include <godot_cpp/core/class_db.hpp>
using namespace godot;
void DefaultJump::_bind_methods(){
ClassDB::bind_method(D_METHOD("get_jump_action_string"), &DefaultJump::get_JumpActionString);
ClassDB::bind_method(D_METHOD("set_jump_action_string", "jump_action_string"), &DefaultJump::set_JumpActionString);
ClassDB::add_property("DefaultJump",PropertyInfo(Variant::STRING, "Jump Action"), "set_jump_action_string", "get_jump_action_string");
/*
ClassDB::bind_method(D_METHOD("get_jump_velocity"), &DefaultJump::get_JumpVelocity);
ClassDB::bind_method(D_METHOD("set_jump_velocity", "jump_velocity"), &DefaultJump::set_JumpVelocity);
ClassDB::add_property("DefaultJump",PropertyInfo(Variant::FLOAT, "Jump Velocity"), "set_jump_velocity", "get_jump_velocity");
*/
}
DefaultJump::DefaultJump(){
this->jump_action_strg = "jump";
/*if(Engine::get_singleton()->is_editor_hint()){
set_process_mode(Node::ProcessMode::PROCESS_MODE_DISABLED);
}*/
}
DefaultJump::~DefaultJump(){
}
//void DefaultJump::_physics_process(double delta){}
StringName DefaultJump::get_JumpActionString() const{
return jump_action_strg;
}
void DefaultJump::set_JumpActionString(const StringName &jmp_strg){
this->jump_action_strg = jmp_strg;
}
float DefaultJump::get_JumpVelocity() const{
return jump_velocity;
}
void DefaultJump::set_JumpVelocity(float jmp_vlc){
this->jump_velocity = jmp_vlc;
}