azesmway / react-native-unity

MIT License
273 stars 67 forks source link

Reopening screen with Unity Component again doesn't open the camera for scanning. #23

Open Gratts27 opened 2 years ago

Gratts27 commented 2 years ago

I see black background when the QR scanning is still going on. It works perfectly fine when I freshly open the app every time. The issue is only seen when I come back to the same page where Unity component is been used.

I tried with the unloadUnity(). I could see camera for fraction of a sec but it goes away and doesn't come back. (Attached Video with Red background)

My POC has 2 screens:

  1. home screen (has a button which navigates to another screen which is using the Unity component).
  2. Unity Component screen (I have just placed one Text component to show it is running or not and the Unity component just below it)

Steps to reproduce.

  1. open the app
  2. click on button which navigates me to next screen
  3. The next screen with Unity Component is opened (I see loading of Unity view, camera starts after some time)
  4. Scan the AR QR(This is to test if the object is getting loaded and is shown on the screen
  5. Hit the back button (This will take you to the home page/prior screen)
  6. Again click on the button to open the Unity component screen (Just like step 2)

Expected: The camera should open up with scanning animation.

Actual: I see the scanning animation but the camera is not getting loaded for long time.

Device: Actual device - OnePlus 3T React native version : 0.68.2 react-native-unity version: 0.2.0

Screenshot_20220526-170231

https://user-images.githubusercontent.com/73434824/170483223-e2107882-0114-4b1a-8665-98c99461082d.mov

With unloadUnity() <<<<<<<

https://user-images.githubusercontent.com/73434824/170486221-35f81262-03f6-4f7b-a66b-14547d6c94d9.mp4

azesmway commented 2 years ago

My opinion - the unity component does not work correctly, the plugin has nothing to do with it. when you completely close the application and the unity closes everything, but when you exit the page, the unloadUnity function works and you need the unity to process it correctly and check the operation of the camera, and when the command is resume, it starts correctly

Gratts27 commented 2 years ago

I tried with both pausing/resuming and unloadUnity it explicitly. Calling the resume is not loading the camera correctly. Could you think of any workaround which might solve this issue for now?

ROBYER1 commented 2 years ago

Have you checked Logcat logs? I get this error and am looking into this now also, the issue only happens on Android and not IOS, is probably a Unity issue more than an issue for React Native/the repo owner

com.example E/libc: Access denied finding property "persist.vendor.camera.privapp.list"