You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
However, I'm not sure how much headway we'll be able to make without an MRP. I've relatively recently tested hot reload with Godot 4.3 and it was working, although, that was with scons. Based on your description it sounds like you're doing what you need to do for hot reload with cmake, but something must not be right if it works for me, but not for you.
Could you share which version of godot-cpp you're using?
We did at one point have an issue with the cmake configuration missing something needed for hot reload, but that should be fixed now.
In Clion press the button to compile, but before finish, switch to godot, the changes not showing.
Godot editor reloads GDExtension only on focus, i.e. if you open the editor before the compilation finishes, and compilation finishes when you're in the editor, you will not see the changes. You have to re-focus the editor. I opened an issue for that a while ago godotengine/godot-proposals#11684
Yeah, I'm not sure about the GDREGISTER_RUNTIME_CLASS vs GDREGISTER_CLASS situation. Maybe you should open a separate issue for that. But I'm glad you got it working in the end.
Almost, because I closed godot, and open again and if I try to modify something, removes everything, like this:
The reason I think why it's failing is because GDREGISTER_CLASS runs your nodes in the editor, and when you rebuild the project, it destroys those objects and calls their destructors, which is where it probably crashes. I saw you had some code for connecting the signal in the constructor (which I think you should be using _ready for), but I don't think you were disconnecting the signal, which would be the reason for the crash.
Working with this new project, adding one by one my original code, godot stop working with hot-reloading when I start working with SQLiteCpp.
So, you're saying that without SQLiteCpp, reloading works fine, but as soon as you add SQLiteCpp, then reloading doesn't work?
It could be that there is something in SQLiteCpp that makes the unloading of your extensions not succeed, which would cause the subsequent reloading to fail.
This is something we've encountered a couple times, for example: on MacOS, using any thread_local variable will prevent unloading from succeeding. Or, if using GCC, building without -fno-gnu-unique will break unloading.
Are you using GCC? I don't know how Conan builds end up coming together, but is it possible the SQLiteCpp files are built without -fno-gnu-unique? Or, cmake configuration should be adding that, but I don't know if it'll make it into the SQLiteCpp build.
Working with this new project, adding one by one my original code, godot stop working with hot-reloading when I start working with SQLiteCpp.
So, you're saying that without SQLiteCpp, reloading works fine, but as soon as you add SQLiteCpp, then reloading doesn't work?
It could be that there is something in SQLiteCpp that makes the unloading of your extensions not succeed, which would cause the subsequent reloading to fail.
This is something we've encountered a couple times, for example: on MacOS, using any thread_local variable will prevent unloading from succeeding. Or, if using GCC, building without -fno-gnu-unique will break unloading.
Are you using GCC? I don't know how Conan builds end up coming together, but is it possible the SQLiteCpp files are built without -fno-gnu-unique? Or, cmake configuration should be adding that, but I don't know if it'll make it into the SQLiteCpp build.
Hi.
I am still playing with Godot + CMake with Conan, and yes, looks like Godot do not like SqliteCpp.
voidSInventory::_enter_tree( ) {
UtilityFunctions::print("SInventory::_enter_tree( )");
SQLite::Database db("data.db", SQLite::OPEN_READWRITE | SQLite::OPEN_CREATE);
std::string qGetStoreItems { "SELECT * FROM StoreItems" };
SQLite::Statement qItemsStore(db, qGetStoreItems);
while (qItemsStore.executeStep( )) {
int storeItemsID = qItemsStore.getColumn(0).getInt( );
int storeItemsType = qItemsStore.getColumn(1).getInt( );
SQLite::Statement qlistItems(
db,
"SELECT * FROM ListItems ""WHERE id = ?""AND type = ?"
);
qlistItems.bind(1, storeItemsID);
qlistItems.bind(2, storeItemsType);
qlistItems.executeStep( );
std::string name = qlistItems.getColumn(1).getString( );
DataItem* item = memnew(DataItem);
item->set_name(name.c_str( ));
m_inventory.push_back(item); // m_inventory is an Array from godot::cpp
}
}
About -fno-gnu-unique in my previous cmake config, yes, if I did not use it, the hot-reloading not works. But in this really really small cmake config, even without enabling -fno-gnu-unique or GODOT_USE_HOT_RELOAD the hot-reloading works ( Yes, I enabled -fno-gnu-unique and GODOT_USE_HOT_RELOAD in this cmake).
The funny thing is:
Close godot.
Erase the .godot of the project.
Compile the project with the SqliteCpp code.
Open godot and everything works excellent. IF I close godot and open again, the hot-reloading stop working, I need to erase again the .godot folder to hot-reloading work.
Possibly your sql code throws an exception in destructor? Try removing the sql code, just linking with it, and see if you get the same issue.
Ahh... I tried as you said and works. So, I start to using Sqlite3 instead of SQliteCpp, but same issue. If I do not use sqlite everything works excellent, but if I try Sqlite3 or SQliteCpp:
Close godot.
Erase the .godot of the project.
Compile the project with the SqliteCpp or Sqlite3 code.
Open godot and everything works excellent. IF I close godot and open again, the hot-reloading stop working, I need to erase again the .godot folder to hot-reloading work.
This is my Sqlite3 code:
sqlite3_stmt* stmt = NULL;
// // ===============================
sqlite3* db;
if (sqlite3_open("data.db", &db) != SQLITE_OK) {
UtilityFunctions::print("SInventory::SInventory =============== cant connect to sqlite");
return;
}
std::string qGetStoreItems { "SELECT * FROM StoreItems" };
int result = sqlite3_prepare_v2(db, qGetStoreItems.c_str( ), -1, &stmt, NULL);
if (result != SQLITE_OK) {
UtilityFunctions::print("SInventory::SInventory Sqlite result Error !!!", sqlite3_errmsg(db));
return;
}
while ((result = sqlite3_step(stmt)) == SQLITE_ROW) {
// Solo muestra el nombre de las columnas// UtilityFunctions::print("id: ", sqlite3_column_name(stmt, 0));// UtilityFunctions::print("--: ", sqlite3_column_name(stmt, 1));// Valores// std::cout << "\nid: " << sqlite3_column_text(stmt, 0);UtilityFunctions::print(
"id: ",
sqlite3_column_int(stmt, 0),
" - ",
reinterpret_cast<constchar*>(sqlite3_column_text(stmt, 1))
// std::string(reinterpret_cast<const char*>(sqlite3_column_text(stmt, 0))).c_str( )
);
// UtilityFunctions::print("--: ", sqlite3_column_text(stmt, 1));
}
sqlite3_finalize(stmt);
sqlite3_close(db);
I tried to set in the Constructor, _ready, _enter_tree.
The funny thing: In C++, if I erase the .godot folder, just the first time that I open godot, let me to use hot-reloading, if I close it, and open again, hot-reloading not work.
Activity
dsnopek commentedon Feb 20, 2025
Thanks for the report!
However, I'm not sure how much headway we'll be able to make without an MRP. I've relatively recently tested hot reload with Godot 4.3 and it was working, although, that was with scons. Based on your description it sounds like you're doing what you need to do for hot reload with cmake, but something must not be right if it works for me, but not for you.
Could you share which version of godot-cpp you're using?
We did at one point have an issue with the cmake configuration missing something needed for hot reload, but that should be fixed now.
chriztheanvill commentedon Feb 20, 2025
I am using the master branch, I downloaded yesterday to test the godot beta 4.4.
Could you share your compile flags ?
ghuser404 commentedon Feb 20, 2025
The correct variable is
GODOT_USE_HOT_RELOAD, notGODOT_ENABLE_HOT_RELOAD.chriztheanvill commentedon Feb 20, 2025
Mmm same result, not working. Also noticed that.
Before Compile:
chriztheanvill commentedon Feb 20, 2025
ghuser404 commentedon Feb 20, 2025
If this still doesn't work, you will have to upload an example project for anyone to be able to help you with this issue.
ghuser404 commentedon Feb 20, 2025
Godot editor reloads GDExtension only on focus, i.e. if you open the editor before the compilation finishes, and compilation finishes when you're in the editor, you will not see the changes. You have to re-focus the editor. I opened an issue for that a while ago godotengine/godot-proposals#11684
ghuser404 commentedon Feb 20, 2025
This means your hot reload is working. I'm not very sure what your issue is right now.
chriztheanvill commentedon Feb 20, 2025
For example, at start I set the Lv of the collectable:
Compile and shows the info in godot, perfect.
Then I want to work with this class, Adding methods, working with the process method, or just add other attribute,
Or If I edit any part of the project, for example, the player.cpp file. The Lv info that showed in Godot, disappear.
CMakeLists.txt
conanfile.txt
ghuser404 commentedon Feb 20, 2025
Upload all project sources, not just those 2 files. Create a small example project, if you don't want to share your sources.
ghuser404 commentedon Feb 20, 2025
The problem is that your node becomes just Area2D instead of your class. I can't tell you the reason for that without seeing sources.
chriztheanvill commentedon Feb 20, 2025
I am making a new project.
I don't get it.
12 remaining items
chriztheanvill commentedon Feb 21, 2025
Almost, because I closed godot, and open again and if I try to modify something, removes everything, like this:
I have to delete the .godot folder to again.
ghuser404 commentedon Feb 21, 2025
Why don't you just use
GDREGISTER_RUNTIME_CLASSif it works for you?ghuser404 commentedon Feb 21, 2025
The reason I think why it's failing is because
GDREGISTER_CLASSruns your nodes in the editor, and when you rebuild the project, it destroys those objects and calls their destructors, which is where it probably crashes. I saw you had some code for connecting the signal in the constructor (which I think you should be using _ready for), but I don't think you were disconnecting the signal, which would be the reason for the crash.chriztheanvill commentedon Feb 22, 2025
Mmm... After playing with a new empty project with CMake. This was not the issue:
Working with this new project, adding one by one my original code, godot stop working with hot-reloading when I start working with SQLiteCpp.
dsnopek commentedon Feb 24, 2025
@chriztheanvill: Thanks for sharing your project!
So, you're saying that without SQLiteCpp, reloading works fine, but as soon as you add SQLiteCpp, then reloading doesn't work?
It could be that there is something in SQLiteCpp that makes the unloading of your extensions not succeed, which would cause the subsequent reloading to fail.
This is something we've encountered a couple times, for example: on MacOS, using any
thread_localvariable will prevent unloading from succeeding. Or, if using GCC, building without-fno-gnu-uniquewill break unloading.Are you using GCC? I don't know how Conan builds end up coming together, but is it possible the SQLiteCpp files are built without
-fno-gnu-unique? Or, cmake configuration should be adding that, but I don't know if it'll make it into the SQLiteCpp build.chriztheanvill commentedon Feb 24, 2025
Hi.
I am still playing with Godot + CMake with Conan, and yes, looks like Godot do not like SqliteCpp.
About
-fno-gnu-uniquein my previous cmake config, yes, if I did not use it, the hot-reloading not works. But in this really really small cmake config, even without enabling-fno-gnu-uniqueorGODOT_USE_HOT_RELOADthe hot-reloading works ( Yes, I enabled-fno-gnu-uniqueandGODOT_USE_HOT_RELOADin this cmake).The funny thing is:
chriztheanvill commentedon Feb 26, 2025
Still happen with rc 2 and using the master of godot-cpp.
ghuser404 commentedon Feb 27, 2025
Possibly your sql code throws an exception in destructor? Try removing the sql code, just linking with it, and see if you get the same issue.
chriztheanvill commentedon Feb 28, 2025
Ahh... I tried as you said and works. So, I start to using Sqlite3 instead of SQliteCpp, but same issue. If I do not use sqlite everything works excellent, but if I try Sqlite3 or SQliteCpp:
This is my Sqlite3 code:
I tried to set in the Constructor, _ready, _enter_tree.
chriztheanvill commentedon Feb 28, 2025
Just tried again with rc3 and download the godot-cpp master again and not working.
chriztheanvill commentedon Mar 3, 2025
And I tried with 4.4 with godot-cpp in 4.4 branch. Still the issues.
chriztheanvill commentedon Mar 3, 2025
And just tried instead of Conan, Vcpkg and same result.
chriztheanvill commentedon Mar 3, 2025
The funny thing: In C++, if I erase the .godot folder, just the first time that I open godot, let me to use hot-reloading, if I close it, and open again, hot-reloading not work.
In C# adding:
Works excellent.
chriztheanvill commentedon Mar 18, 2025
The issues still in 4.4.rc1
chriztheanvill commentedon Oct 12, 2025
The issues still in 4.5-stable