2

I am new to Unity development, so this is totally unexpected behavior for me that I have no idea how to deal with.

My application runs perfectly on Android 10 device when complied using mono. However compilation with IL2CPP breaks some part of the app (an entire complex Object is missing from the scene)

I tried examining device adb logcat logs but there are no exceptions there and the only strange thing is that a large number of log messages that should have been printed (Debug.log) are missing also.

I also installed the latest unity 2022 1.15 (in hope that it was an old bug) but the behavior didn't change.

I really don't know how to proceed to pinpoint what is causing this behavior and then to fix it.

Using Mono is not an option, as the app should be able to run on x64, option available only for IL2CPP.

Edit 1 Forgot to metion that the same APK that has issues on Android 10, runs perfectly on third party android emulator for PC , I suppose it runs ok on other android devices too...

Edit 2 The "complex object" uses SQLite database to fill it with data, could it be SQLite version / android version / il2cpp combination problem?

Any advice would be highly appreciated.

PKey
  • 3,715
  • 1
  • 14
  • 39
  • `an entire complex Object is missing from the scene` doesn't sound like something related to IL2CPP .. maybe something about code stripping that causes something to break and not instantiate correctly? – derHugo Sep 07 '22 at 15:59
  • 1
    And stick to the latest LTS version (currently afaik 2021.3.9f1) unless you really need the newest features ... – derHugo Sep 07 '22 at 16:00
  • @derHugo I was using LTS version and just installed the latest version hoping that it was a bug issue. Also why the same code doesn't break with mono? And how would I find it if there is no exceptions? (Not in editor , not on device) – PKey Sep 07 '22 at 16:03
  • @derHugo so I looked up "code stripping", if I understand it correctly there's no way to turn it off for IL2CPP ... May be I'll try minimal if it wasn't the default already... – PKey Sep 07 '22 at 16:11
  • @derHugo Oh! Forgot to metion the same APK that doesn't run on Android 10, runs perfectly on third party emulator for PC , I suppose it runs on other devices too... – PKey Sep 07 '22 at 16:16
  • 1
    The SQLite thing sounds suspicious (why u have a database in a unity android client program anyway?) I would bet money the issue is being caused by some sort of library like that database. My 1st guess would be the android plugin for database (or some other library u are using) has only 32bit plugin files and not 64 – Guye Incognito Sep 08 '22 at 05:23
  • Check what CPU architecture ure Android phone has then check if the right plugin files are in whatever libraries u are using. If they're missing then u will know what problem is at least. – Guye Incognito Sep 08 '22 at 05:31
  • @GuyeIncognito Thanks!! I had the same idea this morning.... I think I have only 32 bit plugin - going to check that later and post the results. By the way why using Sqlite on android client seems strange to you? – PKey Sep 08 '22 at 06:00

1 Answers1

1

It turns out that the problems wasn't due to IL2CPP scripting, but because of missing 64 bit plugins for SQLlite.

Adding the missing plugin from SQLite4Unity3d solved the problem.

PKey
  • 3,715
  • 1
  • 14
  • 39