react-native-unity-view icon indicating copy to clipboard operation
react-native-unity-view copied to clipboard

Best way to reload Unity view?

Open halileohalilei opened this issue 5 years ago • 4 comments

Is there a way to reload the whole view, together with the running Unity instance? Unmounting and mounting the view doesn't seem to work since my Unity application just resumes instead of restarting. I also tried reloading the scene from Unity, but that's not what I'm really after. Any help or hint on this would be greatly appreciated.

halileohalilei avatar Jul 22 '18 07:07 halileohalilei

Reload must destroy unity player first. You have some scenes that need to be reloaded? Maybe you can try to pause and resume view instead of reload.

f111fei avatar Jul 23 '18 08:07 f111fei

The thing is, I'm using a library that needs camera permissions, and since the permission is not granted the first time the user opens my app, this library throws exceptions at each frame. Even if I reload the scene, the exceptions don't go away, probably because the library does some static initialization when its loaded into memory. There doesn't seem to be anything wrong after reopening the app after granting the camera permissions. So I thought reloading the whole Unity instance might solve this issue.

I also wrote to the people maintaining the library, but any solution to this problem is enough for me.

halileohalilei avatar Jul 23 '18 09:07 halileohalilei

Any updates?

aflahkp avatar Oct 04 '20 10:10 aflahkp

I used ** Application.Unload(); ** to unload unity and navigate to other react native screen, When navigate again to unity view, Unity will reload just fine and will work properly,

But the problem is that messaging is distorted. Unity still can send message and will be receive in react native side, But for react native part when attempt to send message to unity view. Unity will not be able to receive the message.

Im suspecting that react native still trying to send message from the previous view that has been unload.

Does anyone know how to fix this problem?

PLEASE HELP. Thanks!!

shhhiiiii avatar Aug 23 '21 01:08 shhhiiiii