UnLua is a highly optimized Lua scripting solution for Unreal Engine (UE). It follows UE's programming paradigm, is feature-rich, and easy to learn, enabling UE developers to use it with zero learning curve.
- Directly access all
UCLASS,UPROPERTY,UFUNCTION,USTRUCT, andUENUMwithout glue code. - Replace implementations defined in Blueprints (Event / Function).
- Handle various event notifications (Replication / Animation / Input).
For more detailed functionality, check the Feature List.
UFUNCTIONCalls: Includes persistent parameter caching, optimized parameter passing, and improved handling of non-const references and return values.- Access Container Classes: (
TArray,TSet,TMap), memory layout matches the engine, with no need for conversion between Lua tables and containers. - Efficient Struct Handling: Creation, access, and garbage collection (GC).
- Support for Custom Static Export: Includes classes, member variables, member functions, global functions, and enums.
- Runtime Platforms: Windows / Android / iOS / Linux / macOS
- Engine Versions: Unreal Engine 4.17.x - Unreal Engine 5.x
Note: Versions 4.17.x and 4.18.x require modifications to Build.cs.
- Copy the
Pluginsdirectory to the root directory of your UE project. - Restart your UE project.
Note: If you are new to UE, it is recommended to follow the more detailed Quickstart Guide for UE Newbies to continue with the following steps.
- Create and open a Blueprint. In the UnLua toolbar, select
Bind(you can also holdAltto automatically generate the path in step 2). - In the
GetModulefunction of the interface, enter the Lua file path, e.g.,GameModes.BP_MyGameMode. - Select
Create Lua Template Filein the UnLua toolbar. - Open
Content/Script/GameModes/BP_MyGameMode.luaand write your code.
- 01_HelloWorld: A quick start example.
- 02_OverrideBlueprintEvents: Overriding Blueprint events (Overridden Functions).
- 03_BindInputs: Input event binding.
- 04_DynamicBinding: Dynamic binding.
- 05_BindDelegates: Binding, unbinding, and triggering delegates.
- 06_NativeContainers: Accessing native engine containers.
- 07_CallLatentFunction: Calling
Latentfunctions in coroutines. - 08_CppCallLua: Calling Lua from C++.
- 09_StaticExport: Exporting custom types for use in Lua.
- 10_Replications: Overriding network replication events.
- 11_ReleaseUMG: Releasing UMG-related objects.
- 12_CustomLoader: Custom loader.
- 13_AnimNotify: Animation notifications.
Lyra with UnLua: A complete example project based on the official UE Lyra Starter Game Package (currently under development).
- Common Docs: Settings Options | Debugging | IntelliSense | Console Commands | FAQ
- Programming Guide: Introduces UnLua's main features and programming paradigms.
- Plugins and Modules: Describes the plugins in the
Pluginsdirectory and their included modules. - Feature List: A more detailed list of features.
- Implementation Principles: Explains UnLua's two overriding mechanisms.
- API: Detailed UnLua API documentation.
- Official QQ Group: 936285107
- Recommended VSCode Plugin: Lua Booster
