f111fei / react-native-unity-view

Show an unity view in react native
MIT License
402 stars 102 forks source link

Crash on UnityUtils.createPlayer #93

Open halileohalilei opened 5 years ago

halileohalilei commented 5 years ago

I was using a fork of this library, but decided to catch up with the latest release. I updated the library and tried to run it on iOS, but I'm getting this crash on UnityUtils.createPlayer. Here is the stack trace of the crash:

screen shot 2019-02-17 at 17 35 38

The fork I was using had no changes on the iOS side, so it should be as if I'm just trying to upgrade my dependency from version 1.0.4 to 1.3.3. Any ideas why this may be happening?

I'm using Unity 2018.2.8f1, Xcode 10.1, and trying to run on an iPhone SE with iOS 12.1.4. I can provide more information regarding the project if needed.

JanOwiesniak commented 5 years ago

good to know

I'm using react-navigation to navigate through my app.

issue

I was calling UnityModule.createUnity on Screen A and showing an animation to give unity some time to do it's stuff. After the animation was completed and unity was created i switched to Screen B to actually render the unity scene via UnityView.

The app crashed immediately.

my workaround

Create UnityView automagically during render() and do not share UnityView across multiple screens.

ahmetardal commented 5 years ago

Calling InitArgc properly fixed it:

https://github.com/f111fei/react-native-unity-demo/commit/56a0e149a17b31c55ea7c0002ebb3ae15807ed71#diff-e40e5631f2e9f07cae9e5e37e1d65bdaR18

HiMelody commented 4 years ago

Calling InitArgc properly fixed it:

f111fei/react-native-unity-demo@56a0e14#diff-e40e5631f2e9f07cae9e5e37e1d65bdaR18

it works Why Calling InitArgc can fixed it

ahmetardal commented 4 years ago

@HiMelody I don't know.

HiMelody commented 4 years ago

@HiMelody I don't know.

thanks