Error: Cannot run the exported file, but when the file is put into the project, it runs normally.

Godot Version

4.4.1 stable mono

Question

ERROR: System.NullReferenceException: Object reference not set to an instance of an object.
at QuanLyNoiDeBai._Ready() in D:\duanCsharp\gamethebai_remake\script\QuanLyNoiDeBai.cs:line 47
at Godot.Node.InvokeGodotClassMethod(godot_string_name& method, NativeVariantPtrArgs args, godot_variant& ret)
at Godot.CanvasItem.InvokeGodotClassMethod(godot_string_name& method, NativeVariantPtrArgs args, godot_variant& ret)
at Godot.Node2D.InvokeGodotClassMethod(godot_string_name& method, NativeVariantPtrArgs args, godot_variant& ret)
at QuanLyNoiDeBai.InvokeGodotClassMethod(godot_string_name& method, NativeVariantPtrArgs args, godot_variant& ret) in D:\duanCsharp\gamethebai_remake.godot\mono\temp\obj\ExportDebug\win-x64\Godot.SourceGenerators\Godot.SourceGenerators.ScriptMethodsGenerator\QuanLyNoiDeBai_ScriptMethods.generated.cs:line 78
at Godot.Bridge.CSharpInstanceBridge.Call(IntPtr godotObjectGCHandle, godot_string_name* method, godot_variant** args, Int32 argCount, godot_variant_call_error* refCallError, godot_variant* ret)

the line 47 and 78 like "
DataContext dataContext = new DataContext();
Card card_moi1 = card_scene.Instantiate();

(line 47) card_moi1.icon_card = GD.Load(“res://assets/cards/” + dataContext.tblCards.Find(card_moi1.id_card).TenCard + “.svg”);
"
i guess because it cant read .db (sqlite) file even if it is still in the export file or when I put the export file in, there is still a message that the .db file is already available
what can i do to fix this? :<

You can start by giving us more context. What are you doing? Are you using a plugin for SQLite? Which one? What are you doing to try and use it outside the program? What are you expecting to happen?

I can tell you right now that SQLite is great for prototyping and small databases, but it is extremely inefficient long-term and it stores everything in one large database file. In my opinion, it should not be used for production games.

If you’re trying to open the .db file while your Godot project is open or the game is running, you will encounter problems based on the plugin being used. SQLite is not designed for concurrent database use and it’s even worse than other SQL libraries for table locking issues.

I use sqlite to store some information some things in the game and it works pretty well but when I export it the data in the sqlite table is not exported together so an error occurs
So I tried copying the .db file from the project file to export file and it works perfectly

1 Like