Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Re-Mount Unity view with rect-navigation stack #105

Open
ManuSense opened this issue Feb 26, 2024 · 3 comments
Open

Re-Mount Unity view with rect-navigation stack #105

ManuSense opened this issue Feb 26, 2024 · 3 comments

Comments

@ManuSense
Copy link

Using UnityView with react-navigation stack, the first time the stack screen is mounted UnityView load correctly. If then you go to another screen and go back to the Unity one the UnityVieew component doesn't get rendered. I saw a similar issue here: #15 and so i set the prop androidKeepPlayerMounted?: boolean to true. That solved the issue, but caused another one: when from unity screen you go back to a previous screen and after that you return to the unity screen i got the following error:

The specified child already has a parent. You must call removeView() on the child's parent first. addViewInner (ViewGroup.java) addView (ViewGroup.java) addUnityViewToGroup (ReactNativeUnity.java) ...

Any idea how to solve this?

@serdarcevher
Copy link

I have exactly the same issue in Android. Do you have any idea about how to solve this "The specified child already has a parent" issue? @azesmway

@serdarcevher
Copy link

This issue goes away when I use the default stack navigator instead of the native one.

However, this time I got an FPS drop problem (in the device camera) when remounting Unity in Android. It's working fine on iOS though.

@rafaelsalves
Copy link

Hi, there! So, I investigate the problem, and i found that the lib call a routine that "clear" unity after unmount event. So i forked this lib and remove this. Another point, I added a listener to detect that a screen lost the focus and unmount the components that have unity view embedded. So, now works, I have several screens that have unity view, and i can navigate between them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants