I am creating an app that uses Unity as a static library, and i need to be able to start and stop Unity as the user pleases.
From inside iOS native when user presses a button it opens Unity, and then from Unity when user presses exit button, i need the Unity App to close and resume native iOS app.
Starting has been easy, using the [startUnit:application], now to quit the app i have been trying to call applicationWillResignActive, and applicationWillTerminate on unityAppController, but after applicationWillTerminate is called i get an error:
extern"C" void ObjectPool_1_Release_m1110976910_gshared (ObjectPool_1_t3970404496 * __this, Il2CppObject * ___element0, constMethodInfo* method)
{
staticbool s_Il2CppMethodIntialized;
if (!s_Il2CppMethodIntialized)
{
il2cpp_codegen_initialize_method (ObjectPool_1_Release_m1110976910_MetadataUsageId);
s_Il2CppMethodIntialized = true;
}
{
Stack_1_t2974409999 * L_0 = (Stack_1_t2974409999 *)__this->get_m_Stack_0();
NullCheck((Stack_1_t2974409999 *)L_0);
int32_t L_1 = (( int32_t (*) (Stack_1_t2974409999 , constMethodInfo))IL2CPP_RGCTX_METHOD_INFO(method->declaring_type->rgctx_data, 4)->methodPointer)((Stack_1_t2974409999 *)L_0, /hidden argument/IL2CPP_RGCTX_METHOD_INFO(method->declaring_type->rgctx_data, 4));
if ((((int32_t)L_1) <= ((int32_t)0)))
{
goto IL_003b;
}
}
…
and the app crashes, have someone been able to start and stop unity like this?
Thanks!