problems trying to use sqlite with unity 2020.2.2

hello i’m trying to using sqlite with unity, but without any success.

i had used this youtube tutorial

but at the end i always get this error

Loading assembly failed: "Assets/Assemblies/Mono.Data.Sqlite.dll" reason: File does not contain a valid CIL image

Loading assembly failed: "Assets/Assemblies/System.Data.dll" reason: File does not contain a valid CIL image

i remember to get this working on unity 2018 or 2019, but don’t know what is wrong now.

any ideas what i need to do to get ride of this error ?

thanks in advance for all the help

1 Like

sorry for the bump, but i need some help with this

Me to same error, help me please.
Thanks advance

Same issue here. Using Unity 2020.2.7f1

Hey guys, if you’re still having problems this was what worked for me. The issue for me was copying the correct version of the Mono.Data.Sqlite.dll to your game.

Nearly every SQlite Unity tutorial says to go to ” \Unity \Editor\Data\Mono\lib\mono\2.0 ” and copy the “Mono.Data.Sqlite.dll.” However most of those tutorials were written years ago and the folder structure doesn’t look like that anymore.:eyes: Also, there’s multiple versions of the “Mono.Data.Sqlite.dll” in the Unity folder now. The version that worked for me and stopped the errors was located in
“C:\Program Files\Unity\Hub\Editor\2021.1.0b8\Editor\Data\MonoBleedingEdge\lib\mono\unityjit”

After that I had to restart the program, but the “CIL Image” error was gone.

I watched this video in particular as well to help set it up.

Hope that helps folks. :smile:

19 Likes

Can confirm this version doesn’t spit out an error. Thanks!

1 Like

The DLL from “unityjit-win32” folder worked for me
Thanks guys!

thanks a lot!!

I imported sqlite into my project a while back, but I got this error out of nowhere today. Thanks!

The library I’m using
(Mono.Data.Sqlite.dll file.
Unity\Hub\Editor\2022.3.2f1\Editor\Data\MonoBleedingEdge\lib\mono\unityjit-win32)
always treats the INTEGER data type in the database as Int64.

Normally, for INTEGER data types that do not exceed 32 bits (as long as you don’t insert a number greater than 2,147,483,647), you would check if the data type is INTEGER with (fieldType == typeof(int)), and read the data with reader.GetInt32.

However, as initially explained, this particular library always treats the INTEGER type as Int64. Therefore, you must check with (fieldType == typeof(long)), and read the data using reader.GetInt64.

I’ve wasted hours working on this issue with GPT.