1

I have a Unity project built for Android, which uses an SQLite database. But, when i switched platforms to UWP i get these errors:

Reference to type 'Component' claims it is defined in 'System', but it could not be found Reference to type 'ICloneable' claims it is defined in 'mscorlib', but it could not be found

I read that this is because of the incompatibility of the SQLite libraries with UWP. So, i couldn't use System.Dataand Mono.Data.SQLite.

The only solution i could find was to use SQLite4Unity3D as per this link:

https://github.com/codecoding/SQLite4Unity3d

But with this i could not find a replacement for Read() function in DataReader, to read data row by row.

What is the best possible solution to this?

Nand gopal
  • 346
  • 3
  • 17
  • Have your tried [this](https://stackoverflow.com/questions/50753569/setup-database-sqlite-for-unity/50808156?s=1|42.3994#50808156) instruction? – Programmer Jul 10 '18 at 10:27
  • @Programmer: That instruction doesn't have anything pertaining to UWP. My application works perfectly with Android. – Nand gopal Jul 10 '18 at 10:31
  • I don't care if it works with Android or not an yes, I saw the flag in this question. Follow that instruction. When you reach to the "Setting up the UNMANAGED code part" section, simply copy everything from [this](https://github.com/codecoding/SQLite4Unity3d/tree/master/Example/Assets/Plugins/WSA) folder to your "Plugins" folder. – Programmer Jul 10 '18 at 10:39
  • @Programmer: I did exactly what was mentioned. It still doesn't work/gives the same error. What i learned from other posts is that Mono.Data.Sqlite does not work with UWP. – Nand gopal Jul 10 '18 at 11:00
  • After following the instruction, make sure to delete the old dll's you were using. Finally, switch the scripting backend to IL2CPP. – Programmer Jul 10 '18 at 11:07
  • [this](https://answers.unity.com/questions/1462406/il2cpp-missing.html) says not to use IL2CPP. Would it be a problem? Also, would i have to install unity all over again to get it, if it isn't installed? – Nand gopal Jul 10 '18 at 11:32
  • You can use IL2CPP with Hololens. You don't have to re-install Unity if IL2CPP is not installed. Simply find the installer (UnityDownloadAssistant) for the current version Unity you're using. Open it and **de-select** everything. Now, select "Windows Store IL2CPP scripting Backend" and "Windows IL2CPP scripting Backend". That's it. – Programmer Jul 10 '18 at 11:39
  • @Programmer: Reference Rewriter found some errors while running with command --target="Temp\StagingArea\Data\Managed\Assembly-CSharp.dll error occurred along with list of other dlls that were pasted into the plugins folder based on the instructions, when it was built with IL2CPP. – Nand gopal Jul 10 '18 at 12:08
  • What's your Unity version? – Programmer Jul 10 '18 at 12:25
  • @Programmer Unity 2018.1.0f2 – Nand gopal Jul 10 '18 at 12:31
  • It should work then. See [this](https://forum.unity.com/threads/errors-building-uwp-with-sqlite-for-xbox-one.520078/) post about using "mcs.rsp" and "csc.rsp" to fix it. It means you have to move those dll's such as System.Data.dll outside the Assets folder but in the project root folder. Read [this](https://forum.unity.com/threads/errors-building-uwp-with-sqlite-for-xbox-one.520078/#post-3410877) – Programmer Jul 10 '18 at 12:37
  • Thank you so much. It worked. – Nand gopal Jul 10 '18 at 12:46
  • Anytime. Updated my other answer to add uwp support. – Programmer Jul 10 '18 at 13:15
  • @Programmer: I'm sorry. It still have problems. Am i to set scripting runtime version to .NET 4.x? – Nand gopal Jul 10 '18 at 14:58
  • The tutorial doesn't say you have to but since you're using UWP, you will probably need to. If you have issues, try the .NET 4.x. – Programmer Jul 10 '18 at 15:16
  • @Programmer It had built successfully without any scripts. Now when i add a script, i get errors like System.Data.Common.DbDataReader is defined in an assembly that is not referenced. – Nand gopal Jul 10 '18 at 15:38
  • @Programmer Also intellisense stops showing Unity keywords in VS. – Nand gopal Jul 10 '18 at 15:40
  • You referenced all the dll's in the "mcs.rsp" and "csc.rsp" file? There should be 7 of them(dlls) – Programmer Jul 10 '18 at 15:42
  • @Programmer: Like- `-r:System.Data.dll -r:Mono.Data.Sqite.dll` etc, right? – Nand gopal Jul 10 '18 at 15:49
  • Replying to your deletedd comment. No. Not just that. Very close. You have to do it to all of the dlls an the spellings must be correct. The spelling in your last comment isn't fine. See the UWP section in the duplicate. You can just copy it from 3C section in the duplicate. – Programmer Jul 10 '18 at 15:57

0 Answers0