I have added a custom USTRUCT in C++ but it isn’t available in the editor, even after a complete restart. My project is titled “CrashGame”.
In CrashGame.h, I have this:
#pragma once
#include "Engine.h"
#include "CrashTypes.h"
In CrashGame.cpp, I have this:
#include "CrashGame.h"
IMPLEMENT_PRIMARY_GAME_MODULE( FDefaultGameModuleImpl, CrashGame, "CrashGame" );
In CrashTypes.h, I have my custom struct:
#include "SlateBasics.h"
#include "SlateExtras.h"
#include "CrashTypes.generated.h"
#pragma once
USTRUCT()
struct FCrashItem
{
GENERATED_USTRUCT_BODY()
/** A reference to the actual actor this item is for */
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category=Item)
AActor* Item;
/** The image to show in an inventory grid for this item */
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category=Item)
UTexture2D* ItemImage;
/** The name of this item to display in tooltips */
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category=Item)
FText ItemName;
/** The tagline to display in tooltips for this item */
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category=Item)
FText ItemTagline;
/** The number of rows this item occupies (the height) */
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category=Item)
int32 Rows;
/** The number of columns this item occupies (the width) */
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category=Item)
int32 Columns;
/** Set the defaults */
FCrashItem() {
Item = NULL;
ItemImage = NULL;
ItemName = FText::GetEmpty();
ItemTagline = FText::GetEmpty();
Rows = 1;
Columns = 1;
}
};
I get no compile errors when I compile:
1>------ Rebuild All started: Project: CrashGame, Configuration: Development_Editor x64 ------
2>------ Skipped Rebuild All: Project: UE4, Configuration: BuiltWithUnrealBuildTool Win32 ------
2>Project not selected to build for this solution configuration
1> Cleaning CrashGameEditor Binaries...
1> Compiling game modules for hot reload
1> Compiling game modules for hot reload
1> Parsing headers for CrashGameEditor
1> Reflection code generated for CrashGameEditor
1> Performing 7 actions (4 in parallel)
1> [2/7] Resource ModuleVersionResource.rc.inl
1> [3/7] Resource PCLaunch.rc
1> PCH.CrashGame.h.cpp
1> CrashGame.cpp
1> CrashGame.generated.cpp
1> CrashGridPanel.cpp
1> [7/7] Link UE4Editor-CrashGame-7390.dll
1> Creating library D:\My Documents\Unreal Projects\CrashGame\Intermediate/Build/Win64\UE4Editor\Development\UE4Editor-CrashGame-7390.lib and object D:\My Documents\Unreal Projects\CrashGame\Intermediate/Build/Win64\UE4Editor\Development\UE4Editor-CrashGame-7390.exp
1> -------- End Detailed Actions Stats -----------------------------------------------------------
1> Total build time: 75.14 seconds
========== Rebuild All: 1 succeeded, 0 failed, 1 skipped ==========
I imagine I’m missing a step, but I don’t know what.