react-native-unity
react-native-unity copied to clipboard
Unity doesn't load after reloading in metro bundler (Android)
Unity loads perfectly and works each time I run "npm run android" but if I reload the app by pressing R in the metro bundler, I can't get the UnityView to load anymore.
Is there any way to fix this? Will it be a problem in the final version of the app?
The lifecycle methods aren't reliably called on fast refresh. Try adding this to the top of your unity file:
// https://reactnative.dev/docs/fast-refresh#fast-refresh-and-hooks
// @refresh reset
Unfortunately it still freezes whenever a fast refresh is performed (only if the Unity view is visible). But I take it as if this isn't a problem in production since it's specifically during a fast refresh this happens?