Prepare your Unreal project
Install the React Native for Unreal Engine plugin and configure your Unreal project.
On this pageClone the GitHub repository
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
rnueplugin located at etodanik/ReactNativeUnreal into your Plugins folder.git clone https://github.com/etodanik/ReactNativeUnreal.git ReactNativeFor a simple project named
MyGamewith the default structure. You should end up with something similar to the following folder structure:- MyGame.Build.cs
- MyGame.Target.cs
- MyGameEditor.Target.cs
- MyGame.uproject
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
.uprojectfile.You can do so by adding the following snippet to the
Pluginssection of your.uprojectfile:MyGame.uproject { "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
.uprojectfiles 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.csfile located in your project'sSourcefolder:MyGame.Build.cs 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.