hi,
I am trying to create a custom content browser asset using UDataAsset and UFactory. Here is my code:
UCustomAsset.h:
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "Runtime/Engine/Classes/Engine/DataAsset.h"
#include "CustomAsset.generated.h"
UCLASS()
class TESTPROJECT_API URobotCreationData : public UDataAsset
{
GENERATED_BODY()
public:
UCustomAsset::UCustomAsset(const FObjectInitializer& ObjectInitializer);
//~CustomAsset();*/
UPROPERTY(VisibleAnywhere, BlueprintType, BlueprintReadWrite)
int32 TestProperty;
};
UCustomAsset.cpp:
// Fill out your copyright notice in the Description page of Project Settings.
#include "TestProject.h"
#include "UCustomAsset.h"
UCustomAsset::UCustomAsset(const FObjectInitializer& ObjectInitializer)
:Super(ObjectInitializer)
{
}
UCustomAssetFactory.h:
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "UnrealEd.h"
#include "UCustomAssetFactory.generated.h"
UCLASS()
class TESTPROJECT_API UCustomAssetFactory. : public UFactory
{
GENERATED_BODY()
UCustomAssetFactory.(const FObjectInitializer& ObjectInitializer);
virtual UObject* FactoryCreateNew(UClass* Class, UObject* InParent, FName Name, EObjectFlags Flags, UObject* Context, FFeedbackContext* Warn) override;
};
UCustomAssetFactory.cpp:
#include "TestProject.h"
#include "UCustomAsset.h"
#include "UCustomAssetFactory.h"
UCustomAssetFactory::UCustomAssetFactory(const FObjectInitializer& ObjectInitializer)
: Super(ObjectInitializer)
{
bCreateNew = true;
bEditAfterNew = true;
SupportedClass = UCustomAsset::StaticClass();
}
UObject* UCustomAssetFactory::FactoryCreateNew(UClass* Class, UObject* InParent, FName Name, EObjectFlags Flags, UObject* Context, FFeedbackContext* Warn)
{
UCustomAsset* NewObjectAsset = NewObject<UCustomAsset>(Class, Name);
return NewObjectAsset;
}
This doesn’t compile. It doesn’t like UCustomAsset Declaration, therefore it finds an error in every line that uses it.
VS shows an error is at the line with the UCLASS() in UCustomAsset.h
Error message is: this declaration has no storage class or type specifier
Also, I provide the link for the tutorial on which this code is based: