UnrealCLR is an open-source library designed to integrate C# into Unreal Engine, allowing us to use C# for scripting within the game engine instead of the traditional C++.
This tool is aimed at those who wish to leverage the features of the C# language in their Unreal Engine projects, providing a robust (well, more or less) alternative to C++ scripting.
UnrealCLR is a dynamic link library (DLL) that integrates into Unreal Engine to enable communication between the game engine and .NET code. This means we can write game scripts and logic in C#, F#, or any other .NET language and run them inside Unreal Engine.
Features of UnrealCLR,
- Integration with Unreal Engine: Allows the use of C# for scripting instead of C++, making development easier for those who prefer C#.
- Support for Unreal Engine API: Access to most of the engine’s functionalities, including actor manipulation, components, and the event system.
- Interoperability: Allows C# and C++ to coexist in the same project, facilitating the transition or combined use of both languages.
- Faster Development: C# can be simpler and faster to use for certain types of development due to its syntax and features.
For more details and documentation, visit the UnrealCLR repository on GitHub and explore how this library can be integrated into your Unreal Engine projects.
Installing UnrealCLR
To start using UnrealCLR in your Unreal Engine project, follow these steps to install and configure the library:
Prerequisites
- Unreal Engine: Make sure you have a compatible version of Unreal Engine installed (e.g., UE4.25 or higher).
- Visual Studio: You will need Visual Studio with development support for C++ and .NET.
Installation
Clone the UnrealCLR repository from GitHub:
Copy the contents of the cloned repository to the Plugins folder of your Unreal Engine project. Ensure the UnrealCLR directory is directly inside Plugins.
Open your Unreal Engine project in Visual Studio and compile UnrealCLR.
Finally, open the Unreal Engine project. Navigate to Edit -> Plugins and activate the UnrealCLR plugin. Restart the engine to complete the setup.
Using UnrealCLR
Once UnrealCLR is installed and configured, you can start writing scripts in C#. Below, we show you how to do it.
Creating Scripts in C#
Create a C# Script
In the Managed folder of your project, create a new .cs file for your script. Here is a simple example of a C# script:
using UnrealEngine.Framework;
public class MyActor : Actor
{
public override void BeginPlay()
{
base.BeginPlay();
UE_LOG(LogTemp, Warning, "Hello from C#!");
}
public override void Tick(float DeltaTime)
{
base.Tick(DeltaTime);
// Add update logic here
}
}
For changes in your C# code to be reflected in Unreal Engine, you must compile the code using the C# compiler.
Now return to Unreal Engine and open the content editor. In the content view, you can drag and drop your C# class as if it were a normal actor, just as you would with any other C++ actor.

