-
Clone the repository:
git clone https://github.com/Tencent/puerts.git
-
Copy the
Puerts
directory frompuerts/unreal
to your project'sPlugins
directory. You can refer to the Unreal demo for guidance. -
Download V8:
- For UE4.25 and above, choose one: 8.4.371.19, 9.4.146.24, 10.6.194
- For UE4.24 and below: V8 for ue 4.24 or below
-
Extract the downloaded V8 to
YourProject/Plugins/Puerts/ThirdParty
, And Change the UseV8Version setting in JsEnv.build.cs according to version you downloaded.
-
Go to the releases page and find the version you need. Note that this page also includes release packages for Unity; Unreal Engine versions will start with "Unreal".
-
Download the package that matches your UE version and extract it to
YourProject/Plugins
. The V8 library is already included.
-
Mac Users: If you encounter the "Move to Trash" issue, execute the following commands:
cd Plugins/Puerts/ThirdParty find . -name "*.dylib" | xargs sudo xattr -r -d com.apple.quarantine
-
Blueprint-Only Projects: If you see the error "Plugin 'Puerts' failed to load because module 'JsEnv' could not be found,” it’s because pure Blueprint projects do not automatically compile Plugins. Since Puerts includes C++ source code, you need to convert your Blueprint project to a C++ project by adding a C++ class. Alternatively, you can compile the UE engine with Puerts included during the compilation.
Puerts supports multiple script backends: V8, quickjs, nodejs.
- V8: Provides a clean ECMAScript implementation.
- Quickjs: Suitable for scenarios with strict package size requirements.
- Nodejs: Supports more npm modules than the V8 version but results in a larger package size.
Extract the downloaded backend to YourProject/Plugins/Puerts/ThirdParty
.
Modify JsEnv.Build.cs
:
- Set
UseQuickjs
totrue
to use the Quickjs backend. - Set
UseNodejs
to use the Nodejs backend.