Unresolved External Symbol with UFactory Class

I am trying to create a custom asset type. I have created a class based on UObject and now the factory class. These are as followed. When I try to compile I get 60 Unresolved External Symbols.

Note - This class is within a plugin, however, I tested the same code on a normal project and found the same issues.

AmmoTypeFactory.h



#pragma once

#include "Factories/Factory.h"
#include "AmmoTypeFactory.generated.h"
/**
*
*/
UCLASS()
class EXTENSIBLEWEAPONS_API UAmmoTypeFactory : public UFactory
{
    GENERATED_BODY()
public:
    UAmmoTypeFactory();
    virtual UObject* FactoryCreateNew(UClass* InClass, UObject* InParent, FName InName, EObjectFlags Flags, UObject* Context, FFeedbackContext* Warn, FName CallingContext) override;
};


**AmmoTypeFactory.cpp


**
#include "AmmoTypeFactory.h"
#include "AmmoType.h"

UAmmoTypeFactory::UAmmoTypeFactory() : Super()
{
    bCreateNew = true;
    bEditAfterNew = true;
    SupportedClass = UAmmoType::StaticClass();
}

UObject * UAmmoTypeFactory::FactoryCreateNew(UClass * InClass, UObject * InParent, FName InName, EObjectFlags Flags, UObject * Context, FFeedbackContext * Warn, FName CallingContext)
{
    auto NewObjectAsset = NewObject<UAmmoType>(InParent, InClass, InName, Flags);
    return NewObjectAsset;
**}

AmmoType.h**


#pragma once
#include "CoreMinimal.h"
#include "AmmoType.generated.h"

UCLASS(Blueprintable, BlueprintType)
class UAmmoType : public UObject
{
    GENERATED_BODY()
public:
    UPROPERTY(EditAnywhere, BlueprintReadOnly, meta = (ToolTip = ""))
    bool Example = false;
};

AmmoType.cpp


#include "AmmoType.h"

Errors

This is a common error that occurs when you have forgotten to update your projects and plugins modules and build dependencies. Have you updated your Build.cs file to include any dependencies?

https://forums.unrealengine.com/development-discussion/c-gameplay-programming/40950-how-to-set-the-build-cs-file-for-use-slate

Hope this helps

Thanks for the quick replay. I assume it would be placed here. How would I go about finding the correct module I need to include to get the use of the UFactory Class?

Manage to fix it by including UnrealEd under the PrivateDependencyModuleNames

2 Likes

How did you figure out that UnrealEd was the right module?