Skip to content

Plain Unity Expo Integration with ejected RN

Shaunak Das edited this page Dec 3, 2017 · 3 revisions

Ejecting from expo

  • Create a project CRNA command.
  • Eject from expo using this link
npm i -g react-native-cli
# or
yarn global add react-native-cli
npm run eject

When asked for type of eject, select the plain react native project.

  • You will add following to your project.
.buckconfig
.expo/
.gitattributes
android/
index.ios.js
index.js
ios/

First successful run after eject.

  • Import inside Android Studio the android folder. Gradle will ad some files of its own.
  • Run the project using react-native run-android
  • You will see a lot of fonts not working. Solve it using react-native link. It will add android/settings.gradle and android/src/main/java/<package-name>/MainApplication.java. These two files are important.

Importing Unity Project

  • Remove everything from RN project android folder(keep the 2 files mentioned above as backup). Copy Unity project contents into android folder
  • Check MyReactActivity to check for app name in mReactRootView.startReactApplication(mReactInstanceManager, "<app_name>", null);

Running App

  • Using this link
  • Run react-native link. Add settings.gradle and MainApplication.java at the position needed by this command

Clone this wiki locally