react-native-unity
react-native-unity copied to clipboard
onUnityMessage event listener is never removed on component unmount
We are seeing that the onUnityMessage
event prop is not being removed when the UnityView is unmounted.
For example, in our app you log in and you will be navigated to a new screen where we mount the UnityView. On logout, we navigate back to the login page, and the UnityView screen is unmounted. If you log back in (without killing the app) and navigate to the UnityView screen, the onUnityMessage
events are duplicated. Seems like a memory leak somewhere in the Native Module.
Note: I have only tested this in iOS, as our app is iOS only.
Can you provide an example of the UnityView being certainly unmounted? We are building an iOS and Android app, and on android we see issues with the mount being in an odd state after logging out, which causes crashes when we return to the Unity Component. We too believe that the Unity Component should be unmounted by our process, but I have had difficulties proving such either way during runtime tests. I have a feeling our troubles here are related.
@Agreafel What kind of example are you asking for? The example I gave in my original post sounds very similar to what you described in your project.
@rcorrie Like a screen capture or code snippet of the moment Unity becomes unmounted. I am not thoroughly familiar with testing to demonstrate this as fact, and I was hoping for some insight on how I can be certain of the state of Unity during these sorts of logout cycles.