I did the same thing. But the results were not pretty.
It is not easy to support callback functions and needs to be bridged through C.
But I still implemented it.
In my demo project, it works well in most scenarios. window, android, ios.
But! On the Android platform, apk compiled through IL2CPP has fatal problems.
Problem 1: The callback is not safe. It may conflict with the GC of IL2CPP and crash.
Problem 2: The initialization of .so may conflict with other unity transactions, and crash.
I did the same thing. But the results were not pretty.
It is not easy to support callback functions and needs to be bridged through C.
But I still implemented it.
In my demo project, it works well in most scenarios. window, android, ios.
But! On the Android platform, apk compiled through IL2CPP has fatal problems.
Problem 1: The callback is not safe. It may conflict with the GC of IL2CPP and crash.
Problem 2: The initialization of .so may conflict with other unity transactions, and crash.