- Home /
Unity3D and React Native
We are working on creating a Unity game with a large UI component. We are considering using React Native for the UI. Do you know if this is possible?
Answer by shaunakdas2020 · Aug 23, 2017 at 05:00 PM
Finally after a lot of trials managed to do this. These are the steps.
1) Using this link, export android project for Gradle. Select Gradle in the Build Settings window and check the Export Project checkbox. Click Export and select the destination folder.
2) Import the generated folder in Android studio. Select ok whenever prompted. In this process, you will encounter following issues
2a) Gradle Sync Failed due to org.gradle.api.internal.tasks issues. Resolve using this link
3) Create React Native App using this link
4) Start Integrating Android exported folder inside created react native app using this link. Don't upgrade Gradle as Android Studio will ask you again and again. You will encounter following issues. Don't go through "Test Integration" until you are finished with #5 here.
4a) While configuring Maven, use this url for Maven url "$rootDir/../node_modules/react-native/android" .
4b) While configuring maven if you encounter a problem related to javax.inject:javax.inject". Use this link.
4c) You may also encounter this error "Conflict with dependency 'com.google.code.findbugs:jsr305'". You can solve it using this link.
4d) During Code integration section of this link, focus on the following section: If you are using a starter kit for React Native, replace the "HelloWorld" string with the one in your index.android.js file (it’s the first argument to the AppRegistry.registerComponent() method). Here you have to replace with the project name.
5) Before going through "Test your Integration" section, you have to add code to call MyReactActivity from UnityActivity. This link will help.
6) Go through "Test your Integration" section of link provided in #4. You may encounter following problems.
6a) unable to load script from assets index.android.bundle. Use this link.
6b) could not connect to development server on android. Use this link.
Answer by marijnz · Jan 13, 2018 at 09:18 PM
I created an example project of how to do this for Android: https://github.com/marijnz/unity-react
Your answer
![](https://koobas.hobune.stream/wayback/20220612041605im_/https://answers.unity.com/themes/thub/images/avi.jpg)