Now only supports iOS, Android will also support in the future.
npm install react-native-unity --save
react-native link react-native-unity
- In XCode, in the project navigator, right click
Libraries➜Add Files to [your project's name] - Go to
node_modules➜react-native-unityand addRNUnity2019.xcodeproj - In XCode, in the project navigator, select your project. Add
libRNUnity2019.ato your project'sBuild Phases➜Link Binary With Libraries
- Create UnityProject with Unity 2019.3.0a3 +
- Open UnityProject folder in Unity and export the project to the folder UnityProject and save as ios.
- Add ios project(from step 2) to your workspace
- Update items required for use with UnityFramework.framework (these steps are required any time you re-export your ios project from Unity):
- Add UnityFramework.framework to Embedded Binaries
- add Unity-iPhone/Products/UnityFramework.framework to Embedded Binaries (this will also add as Linked Framework, which we remove next step)
- remove UnityFramework.framework from Linked Frameworks and Libraries ( select it and press "-" )
- Select Unity-iPhone / Libraries / Plugins / iOS / NativeCallProxy.h and enable UnityFramework in Target Membership and set Public**
- Select Unity-iPhone / Data and swap Target Membership to UnityFramework from Unity-iPhone**
- Add UnityFramework.framework to Embedded Binaries
- Set "Header Search Path" of libRNUnity2019.a under the Pods project to point to UnityFramework.framework
- Run your project (
Cmd+R)<
import RNUnityView from 'react-native-unity';
<RNUnityView style={{left: 50, top: -20, width: 300, height: 400}} />