I have a c++ class called WeakPotion that is derived from UObject. I try to construct an instance of it in blueprints but when I run the game and attempt to construct it, unreal crashes and gives me this error message:
Assertion failed: [File:D:\Build\++UE4\Sync\Engine\Source\Runtime\CoreUObject\Private\UObject\UObjectGlobals.cpp] [Line: 2496] *INVALID* is not being constructed with either NewObject, NewNamedObject or ConstructObject.
How can I construct an instance of my class in blueprint? I am using version 4.22.
WeakPoition.h
#pragma once
#include "CoreMinimal.h"
#include "SuperItem.h"
#include "WeakPotion.generated.h"
UCLASS(BlueprintType)
class WIZARDS_V2_API UWeakPotion : public USuperItem
{
GENERATED_BODY()
public:
UWeakPotion();
UWeakPotion(int);
virtual ~UWeakPotion(); // abstract class
bool useItem() override;
};
SuperItem.h
#pragma once
#include "CoreMinimal.h"
#include "UObject/NoExportTypes.h"
#include "SuperItem.generated.h"
UENUM(BlueprintType)
enum EItemIds
{
...
};
UENUM(BlueprintType)
enum EItemTypes
{
...
};
UCLASS(Blueprintable)
class WIZARDS_V2_API USuperItem : public UObject
{
GENERATED_BODY()
public:
USuperItem();
USuperItem(EItemIds, FString, EItemTypes, int);
virtual ~USuperItem(); // abstract class
...
};
Level Blueprint