Unreal C++ Class Generator
Generate .h and .cpp files for an Actor, Component, Character, Subsystem, Data Asset, Interface or Struct, with the right prefix, includes and path.
- ✓ Free, no sign-up
- ✓ Made for Unreal Engine
- ✓ Runs in your browser
Something not working, or an idea to make this tool better? Report a problem or suggest an improvement.
Why generate the files instead of copying an old class?
Copying a class and renaming it is how most Unreal C++ compile errors start: a leftover .generated.h include with the old name, an API macro from another module, a missing prefix or a header in the wrong folder. This generator writes the files in the same shape as the editor’s New C++ Class wizard, so they compile on the first build.
What each part does
| Part | Why it is there |
|---|---|
#include "CoreMinimal.h" | Basic engine types (FString, TArray, UE_LOG…). |
#include "Parent.h" | The header of the class you inherit from. |
#include "Name.generated.h" | Code written by Unreal Header Tool. Must be the last include and match the file name. |
UCLASS() / USTRUCT() | Registers the type with Unreal’s reflection system (Blueprints, editor, garbage collection). |
MYGAME_API | Exports the class from your module so other modules can use it. |
GENERATED_BODY() | Where the generated reflection code is inserted. Always the first line inside the class. |
Which parent class to choose
- Actor: anything placed or spawned in a level (doors, pickups, shelves).
- Actor Component: reusable behaviour you attach to actors (inventory, health). Scene Component if it needs a position.
- Character / Pawn: something a player or AI possesses. Character adds a capsule, mesh and walking movement.
- Data Asset / Primary Data Asset: data you edit in the Content Browser, like item definitions. Primary Data Assets can be loaded and listed by the Asset Manager.
- Subsystems: one automatic instance per game instance, world or local player, with no setup. Good for managers (save game, quests, economy).
- Interface: a shared function set for unrelated classes (for example
Interacton doors and NPCs). - Struct: plain data with no behaviour, such as a DataTable row.
Turn off Tick unless you need it
New actors and components tick every frame by default in the editor’s templates. Most gameplay code reacts to events or timers instead. With Tick unticked, the generator sets bCanEverTick = false and leaves out the Tick function.
FAQ
Where should Unreal C++ files go?
In your module’s folder under Source. With the Public/Private layout, headers go in Source/<Module>/Public and .cpp files in Source/<Module>/Private, mirroring any subfolders. Do not add files through Visual Studio’s Add New Item dialog: by default it saves them under Intermediate/ProjectFiles, which is not part of your module, so Unreal never compiles them.
What do the A, U, F and I prefixes mean?
Unreal’s build tools require them. A is for classes derived from AActor, U for other UObject classes (components, subsystems, data assets), F for structs and I for the interface class of a UINTERFACE. The file name is the class name without the prefix.
What is MYGAME_API in an Unreal class?
It is the export macro of your module: the module name in capitals followed by _API. It lets other modules use the class. If the module name in the macro does not match your module, you get linker errors.
What do I do after adding the files?
Close the editor, right-click the .uproject and generate the Visual Studio project files (or refresh the project in Rider), then build from your IDE and open the editor again. Live Coding is fine for changes inside functions, but new classes are most reliable after a full build.
Guides for this tool
- How to Add a C++ Class in Unreal Engine the Right WayUnreal Engine · Nov 18, 2026 · 4 min read
More free tools
Unity ↔ Unreal Converter
Convert positions, rotations and scale between Unity (meters, Y-up) and Unreal (centimeters, Z-up).
Open tool →Easing Functions & Curves
Preview every easing curve live and copy ready-to-use code for Unity C# and Unreal C++.
Open tool →Unreal Engine Console Commands & CVars
Searchable list of the Unreal console commands and CVars you actually use for profiling, rendering and debugging, with Unity equivalents.
Open tool →