/react-native-unity-demo

React Native + Unity3D Demo

Primary LanguageC#GNU General Public License v3.0GPL-3.0

react-native-unity-demo

React Native + Unity3D Demo. Supports iOS and Android both.

Requirements: Android Studio 3.4.2+ Unity version 2019.3.0b4+

How to Build (iOS)

  1. Run Unity3D and build project for iOS into "unity/build/ios" folder.
  2. Run command "yarn install".
  3. Run command "pod install" in ios folder.
  4. Open ios workspace.
  5. Import Unity-iPhone project into workspece.
  6. Change "Unity-iPhone>Data" Target membership to "UnityFramework".

7. Change "Unity-iPhone>Libraries>Plugins>iOS>NativeCallProxy.h" Target membership to "UnityFramework (public)".

8. Import Unity-iPhone>Products>UnityFramework.framework file into Project Settings>Build Phases>Embeded Frameworks. - Drag Unity-iPhone>Products>UnityFramework.framework to Project Settings>Frameworks, Libraries, and Embedded Content

- After remove UnityFramework.framework in Project Settings>Build Phases>Link Binary With Libraries.

9. Build project.

How to Build (Android)

  1. Run Unity3D and build (* with Export Project option) project for Android into "unity/build/android" folder.
  2. Run command "yarn install".
  3. Open Android Studio and import the unity3D project into Android Studio.
  4. Append the following lines to android/settings.gradle:
...
include ':unityLibrary'
project(':unityLibrary').projectDir=new File('..\\unity\\build\\android\\unityLibrary')
  1. Insert the following lines inside the dependencies block in android/app/build.gradle:
  implementation project(':unityLibrary')
  implementation files("${project(':unityLibrary').projectDir}/libs/unity-classes.jar")