I can’t figure out how to properly add just a plain standalone .h file into my project so that it properly hooks into Unreal. I can add new classes using the wizard from the editor and that hooks them in automatically, but how can I do the same without using the wizard?
I want to define a struct in a standalone header, rather than in an existing class file for organizational purposes.
hi,
the way i add my files is by copying all files to the /projectfolder/source/projectname/ folder and then rightclick the unreal project file and hit regenerate visual studio files
// Your copyright
#pragma once
#include "SomeOther.h"
#include "MyStruct.generated.h" // this must be last include in the file
USTRUCT()
struct FMyStruct
{
GENERATED_USTRUCT_BODY()
// add stuff you'd like to
};
You also must supply a .cpp file. It will be like this:
// Your copyright
#include "YourProjectName.h" // this header is typically inside your project's source root directory
#include "MyStruct.h"
// add stuff you'd like to
Then you should regenerate project file and build.