react-native-unity
react-native-unity copied to clipboard
unloadUnity() no work
Hello,
When opening the unity module for the first time there is no problem, but when reopening show the previous state, not restart.
To close UNITY I use:
unityRef.current.unloadUnity();
navigation.goBack();
But it continues to save the previous state, that is, I open a SCENE X on Unity for the first time, I close and then reopen Unity to open a SCENE Y and it continues to show the SCENE X.
Then I try again to open the SCENE Y and there it already shows the SCENE Y, but if I continue playing when showing the SCENE X again it shows me SCENE Y again and so on.
Hello, I have the same issue when I go back to react-native scene and go again to my unity view it crashes the app and I noticed that it doesn't continue from its previous state it's like it launches the unity again so maybe it crashes from low memory. if any one have any related ideas could use unload or anything else thank you.
Hello, I have a similar issue as well.
I unload the unity and go back
navigation.goBack();
Next time when I open the unity view I get only a blank screen. The unity game does not launch.
When the unload function is called I get this error in the logcat
2022-08-30 12:24:24.184 16354-19822/com.android.myfab11pro I/Unity: Back button called
UnityEngine.Events.UnityAction:Invoke()
UnityEngine.Events.UnityEvent:Invoke()
UnityEngine.EventSystems.EventFunction`1:Invoke(T1, BaseEventData)
UnityEngine.EventSystems.ExecuteEvents:Execute(GameObject, BaseEventData, EventFunction`1)
UnityEngine.EventSystems.StandaloneInputModule:ProcessTouchPress(PointerEventData, Boolean, Boolean)
UnityEngine.EventSystems.StandaloneInputModule:ProcessTouchEvents()
UnityEngine.EventSystems.StandaloneInputModule:Process()
(Filename: ./Runtime/Export/Debug/Debug.bindings.h Line: 35)
2022-08-30 12:24:24.292 16354-16354/com.android.myfab11pro I/ReactNative: [GESTURE HANDLER] Gesture handler is already enabled for a parent view
2022-08-30 12:24:24.303 16354-19866/com.android.myfab11pro E/Unity: ThreadAbortException
at SocketIO.SocketIOComponent.RunSocketThread (System.Object obj) [0x00000] in <00000000000000000000000000000000>:0
at System.Threading.ParameterizedThreadStart.Invoke (System.Object obj) [0x00000] in <00000000000000000000000000000000>:0
at System.Threading.ContextCallback.Invoke (System.Object state) [0x00000] in <00000000000000000000000000000000>:0
at System.Threading.ExecutionContext.RunInternal (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x00000] in <00000000000000000000000000000000>:0
at System.Threading.ParameterizedThreadStart.Invoke (System.Object obj) [0x00000] in <00000000000000000000000000000000>:0
System.UnhandledExceptionEventHandler:Invoke(Object, UnhandledExceptionEventArgs)
(Filename: currently not available on il2cpp Line: -1)
2022-08-30 12:24:24.304 16354-19868/com.android.myfab11pro E/Unity: ThreadAbortException
at SocketIO.SocketIOComponent.RunPingThread (System.Object obj) [0x00000] in <00000000000000000000000000000000>:0
at System.Threading.ParameterizedThreadStart.Invoke (System.Object obj) [0x00000] in <00000000000000000000000000000000>:0
at System.Threading.ContextCallback.Invoke (System.Object state) [0x00000] in <00000000000000000000000000000000>:0
at System.Threading.ExecutionContext.RunInternal (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x00000] in <00000000000000000000000000000000>:0
at System.Threading.ParameterizedThreadStart.Invoke (System.Object obj) [0x00000] in <00000000000000000000000000000000>:0
System.UnhandledExceptionEventHandler:Invoke(Object, UnhandledExceptionEventArgs)
(Filename: currently not available on il2cpp Line: -1)
When I go back to the unity view screen I get this error in the logcat
2022-08-30 12:26:35.524 16354-19822/com.android.myfab11pro D/AudioTrack: ClientUid 10558 AudioTrack::start
2022-08-30 12:26:35.529 16354-16354/com.android.myfab11pro V/MediaRouter: Selecting route: RouteInfo{ name=Phone, description=null, status=null, category=RouteCategory{ name=System types=ROUTE_TYPE_LIVE_AUDIO ROUTE_TYPE_LIVE_VIDEO groupable=false }, supportedTypes=ROUTE_TYPE_LIVE_AUDIO ROUTE_TYPE_LIVE_VIDEO , presentationDisplay=null }
2022-08-30 12:26:35.546 16354-20430/com.android.myfab11pro E/Unity: ThreadAbortException
at SocketIO.SocketIOComponent.RunPingThread (System.Object obj) [0x00000] in <00000000000000000000000000000000>:0
at System.Threading.ParameterizedThreadStart.Invoke (System.Object obj) [0x00000] in <00000000000000000000000000000000>:0
at System.Threading.ContextCallback.Invoke (System.Object state) [0x00000] in <00000000000000000000000000000000>:0
at System.Threading.ExecutionContext.RunInternal (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x00000] in <00000000000000000000000000000000>:0
at System.Threading.ParameterizedThreadStart.Invoke (System.Object obj) [0x00000] in <00000000000000000000000000000000>:0
System.UnhandledExceptionEventHandler:Invoke(Object, UnhandledExceptionEventArgs)
(Filename: currently not available on il2cpp Line: -1)
2022-08-30 12:26:35.576 16354-20429/com.android.myfab11pro E/Unity: ThreadAbortException
at SocketIO.SocketIOComponent.RunSocketThread (System.Object obj) [0x00000] in <00000000000000000000000000000000>:0
at System.Threading.ParameterizedThreadStart.Invoke (System.Object obj) [0x00000] in <00000000000000000000000000000000>:0
at System.Threading.ContextCallback.Invoke (System.Object state) [0x00000] in <00000000000000000000000000000000>:0
at System.Threading.ExecutionContext.RunInternal (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x00000] in <00000000000000000000000000000000>:0
at System.Threading.ParameterizedThreadStart.Invoke (System.Object obj) [0x00000] in <00000000000000000000000000000000>:0
System.UnhandledExceptionEventHandler:Invoke(Object, UnhandledExceptionEventArgs)
(Filename: currently not available on il2cpp Line: -1)
2022-08-30 12:26:35.581 16354-19822/com.android.myfab11pro D/roid.myfab11pr: PlayerBase::stop() from IPlayer
2022-08-30 12:26:35.581 16354-19822/com.android.myfab11pro D/AudioTrack: ClientUid 10558 AudioTrack::stop
2022-08-30 12:26:35.581 16354-19822/com.android.myfab11pro D/AudioTrack: stop(14365): called with 1924 frames delivered
@azesmway we are facing the same issue. here are our environment details: Windows 10 Pro Android Studio Chipmunk - 2021.2.1 React Native 0.70.0 Unity Editor Version 2021.3.9f1
hoping to get some help soon.
I'm facing the same issue :( Hi, @azesmway you have any solutions for this?
Any solution to this?
getting the same issues
Hello,
When opening the unity module for the first time there is no problem, but when reopening show the previous state, not restart.
To close UNITY I use:
unityRef.current.unloadUnity(); navigation.goBack();But it continues to save the previous state, that is, I open a SCENE X on Unity for the first time, I close and then reopen Unity to open a SCENE Y and it continues to show the SCENE X.
Then I try again to open the SCENE Y and there it already shows the SCENE Y, but if I continue playing when showing the SCENE X again it shows me SCENE Y again and so on.
Did you find any solution?
I am getting the same issue!
the plugin only starts the unit itself and then unloads it from memory using the documented Unity functions. manage scene restarts in Unity itself - you should handle events using only Unity itself
the plugin only starts the unit itself and then unloads it from memory using the documented Unity functions. manage scene restarts in Unity itself - you should handle events using only Unity itself
can you please provide an sample code for that, Thank you
I am a RN developer Unity I know only at the assembly level of the project
For me the application is crashing as in the attached video - https://user-images.githubusercontent.com/22703602/167987171-13875d0e-8b25-4625-bc25-299569d4e7b9.mp4
@azesmway I resolved the issue by NOT calling unloadUnity, but if I do navigation back and then come to the screen with unityview it crashes/freezes without starting unity again and this happens on a few devices only, on another device it works fine. any idea ?
@harrymash2006 I am also facing the same issue, on which device it's working fine? I am using S8.
@azesmway I resolved the issue by NOT calling unloadUnity, but if I do navigation back and then come to the screen with unityview it crashes/freezes without starting unity again and this happens on a few devices only, on another device it works fine. any idea ?
@harrymash2006 How did you fix crashing on the navigation back?
@ambojialur I just do not call unloadUnity function and it stops crashing
@ambojialur I just do not call unloadUnity function and it stops crashing
Can you please share your code if possible, Thank you
If unloadUnity () is not called the app will not crash but then the game would keep running in the background. This can cause issues like unnecessary sounds and consuming too much memory.
So I modified the library as done in the fork. Then unloadUnity () wont be called automatically when going back but calling it manually then does solve the problem.
@Karrthik-Arya It's not crashing now, The issue is when navigating back from the unity view and reopening the unity view it's not relaunching the unity view. it's just showing the previously opened view.
@azesmway Can you please help me that why app is crashing after getting below message
2022-10-24 /com.example W/Unity: Timeout while trying detaching primary window.
2022-10-24 /com.example E/CRASH: other thread is trapped; signum = 11
2022-10-24 /com.example E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example, PID: 123
java.lang.Error: *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
Version '2021.3.11f1 (asdf)', Build type 'Release', Scripting Backend 'il2cpp', CPU 'arm64-v8a'
Build fingerprint: 'mobiledevice/dreamltexx/dreamlte:9/PPR1.180610.011/ASDF09876:user/release-keys'
Revision: '10'
ABI: 'arm64'
Timestamp: 2022-10-24 16:53:25+123
pid: 123, tid: 123, name: Thread-11 >>> com.example <<<
uid: 123
signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x44
Cause: null pointer dereference
x0 0000000000000000 x1 0000006e59afed38 x2 0000006e59afed44 x3 0000000000000002
@Karrthik-Arya, thx. work for me.
Hello , has anyone found a solution with unloadUnity() and Black screen ? currently Im using @azesmway/react-native-unity": "^1.0.5