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

Start Unity while unfocussed and pause it when it's reached a satisfactory start state

Open SethCram opened this issue 1 year ago • 5 comments

Hi @azesmway thanks for maintaining this repo!!

I recently upgraded from v0.3.1 to v1.0.10, and I noticed that previously, my Unity game would start loading by default even when not focused, requiring a manual pause on mount. In the new version, I'm looking for a way to manually enable this behavior. My Unity content is in a separate screen that loads in the background when a tab navigator is first initialized, but since the Unity tab isn't the first one focused, I'd like the game to load in the background so it's ready at scene 1 when first navigated to. However, I've tried using unityRef.current.resumeUnity(); and unityRef.current.windowFocusChanged(true); when the tab is mounted, but neither approach has worked on Android. So far, the only way I've managed to start the game is by manually focusing the tab.

SethCram avatar Aug 24 '24 01:08 SethCram

same here, confused me two days

IhsotasTon avatar Aug 24 '24 08:08 IhsotasTon

any solution?

sajidhashmi avatar Sep 19 '24 14:09 sajidhashmi

@sajidhashmi nope, not that I know of. I'm considering just setting the initial route to the tab with the game in it, then navigating away so it atleast starts loading

SethCram avatar Oct 25 '24 02:10 SethCram

hey, any solution?

abhayrajput87 avatar Jul 05 '25 22:07 abhayrajput87

@abhayrajput87 I'm just setting the initial route to the tab with the game in it, then navigating away so it atleast starts loading.

SethCram avatar Aug 01 '25 23:08 SethCram