Microsoft Docs – .NET Gaming APIs

UE4Sharp

UE4Sharp is a .NET 6+ wrapper that enables C# developers to write gameplay code for Unreal Engine 4 (UE4) using familiar .NET constructs while retaining the performance and flexibility of native UE4.

Key Features

Getting Started

Follow these steps to create your first UE4Sharp project.

  1. Install the UE4Sharp SDK from the download section below.
  2. Generate a new UE4 project or open an existing one.
  3. Run ue4sharp init in the project root to bootstrap the C# solution.
  4. Open the generated solution in Visual Studio, add your gameplay logic, and build.
  5. Press Play in the UE4 editor – UE4Sharp automatically loads the compiled assembly.

Setup & Installation

# Using .NET CLI
dotnet tool install -g ue4sharp-cli

# Verify installation
ue4sharp --version

If you prefer a manual installation, download the installer package and run it.

Basic Usage

C#
C++ (Equivalent)
// MyCharacter.cs
using UE4Sharp;
using UE4Sharp.Engine;
using UE4Sharp.Input;

public class MyCharacter : UE4Sharp.Actor
{
    protected override void BeginPlay()
    {
        base.BeginPlay();
        UE4.Log.Info("Hello from UE4Sharp!");
    }

    public override void Tick(float deltaTime)
    {
        base.Tick(deltaTime);
        // Simple movement logic
        var move = GetInputAxis("MoveForward");
        AddMovementInput(Vector.Forward * move);
    }
}

Advanced Topics

Blueprint Integration

Mark managed classes with [Blueprintable] to expose them to the Blueprint system.

[Blueprintable]
public class MyPickup : UE4Sharp.Actor
{
    [BlueprintCallable]
    public void Activate()
    {
        // Logic
    }
}

Live Reload

During an editor session, UE4Sharp watches compiled assemblies. Any change in managed code will trigger a hot-reload without restarting the editor.

API Reference

Browse the full API documentation here.

Samples

FAQ

Can I use UE4Sharp with UE5?
UE4Sharp targets UE4. For UE5, use the upcoming UE5Sharp preview.
Is garbage collection handled automatically?
Yes. UE4Sharp maps .NET GC to UE4's object lifecycle. Use Dispose for unmanaged resources.
Does UE4Sharp support hot‑reloading of Blueprint assets?
Only managed code is hot‑reloaded. Blueprint changes require a normal compile.

Download UE4Sharp

Latest stable version: v2.4.1

Download Installer