Prepare your Unreal project
Install the React Native for Unreal Engine plugin and configure your Unreal project.
This section assumes you are familiar with the basics of the Unreal Engine plugin system. Read more about it in the Unreal Engine documentation on plugins.
Clone the GitHub repository
Clone the rnue plugin located at etodanik/ReactNativeUnreal into your Plugins folder.
git clone https://github.com/etodanik/ReactNativeUnreal.git ReactNativeFor a simple project named MyGame with the default structure. You should end up with something similar to the following folder structure:
The folder structure can differ for more complex projects.
Enable the plugin
Now that the plugin is cloned, you need to enable it by editing your .uproject file.
You can do so by adding the following snippet to the Plugins section of your .uproject file:
{
"FileVersion": 3,
"Version": 1,
"VersionName": "1.0",
"FriendlyName": "MyGame",
"Description": "",
"Category": "Other",
"CreatedBy": "",
"CreatedByURL": "",
"DocsURL": "",
"MarketplaceURL": "",
"CanContainContent": true,
"IsBetaVersion": false,
"IsExperimentalVersion": false,
"Installed": true,
"PreBuildSteps": {},
"Plugins": [
{
"Name": "React",
"Enabled": true,
"Version": 2
}
],
"Modules": [
{
"Name": "MyGame",
"Type": "Runtime",
"LoadingPhase": "PreDefault"
}
]
}Your .uproject files could look different depending on your project structure. Read more about it in the Unreal Engine documentation on .uproject files.
Add the ReactNative module to your Build.cs file
Unreal Engine resolves dependencies in code through its UBT build system.
To add the ReactNative module to your project, you need to edit the Build.cs file located in your project's Source folder:
using UnrealBuildTool;
public class MyGame : ModuleRules
{
public MyGame(ReadOnlyTargetRules Target) : base(Target)
{
bUseRTTI = true;
bEnableExceptions = true;
PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs;
PublicDependencyModuleNames.AddRange(
new[]
{
"Core"
}
);
PrivateDependencyModuleNames.AddRange(
new[]
{
"ReactNative"
}
);
}
}All done!
You are now ready to start using React Native in your Unreal Engine project.
To learn more about how modules work in Unreal Engine, read the Unreal Engine documentation on modules.