Hi guys,
I’m sorry if this seems obvious or is an unnecessary thing to do, but what I want to do is create a custom “Quest” asset that shows up in the content browser to help more easily find it. The asset itself inherits from the Actor class because I would like for it to have all the bells and whistles of the actors (Idk if I’m allowed to say this here, but if anyone has ever used REDkit to mod the witcher 2, that was where I really got my love of game design and I liked the quest editor in that so I was trying to create something similar here, hence why it is its own actor, in addition to just needing a begin play and access to delays and the like in bp extended classes).
So to make it show in the content browser independently, I created a “Factory” class for it that looks like this:
QuestActor_Factory.h:
#pragma once
#include "CoreMinimal.h"
#include "Factories/Factory.h"
#include "UnrealEd.h"
#include "QuestActor_Factory.generated.h"
/**
*
*/
UCLASS()
class QUESTSYSTEM_API UQuestActor_Factory : public UFactory
{
GENERATED_BODY()
UQuestActor_Factory();
virtual UObject* FactoryCreateNew(UClass* Class, UObject* InParent, FName Name, EObjectFlags Flags, UObject* Context, FFeedbackContext* Warn) override;
virtual bool ShouldShowInNewMenu() const override;
virtual uint32 GetMenuCategories() const override;
};
QuestActor_Factory.cpp:
#include “QuestActor_Factory.h”
#include "QuestActor.h"
//The asset type categories will let us access the various asset categories inside the Editor
#include "AssetTypeCategories.h"
UQuestActor_Factory::UQuestActor_Factory()
{
SupportedClass = AQuestActor::StaticClass();
bCreateNew = true;
bEditAfterNew = true;
}
UObject* UQuestActor_Factory::FactoryCreateNew(UClass* Class, UObject* InParent, FName Name, EObjectFlags Flags, UObject* Context, FFeedbackContext* Warn)
{
AQuestActor* NewObjectAsset = NewObject<AQuestActor>(InParent, Class, Name, Flags);
return NewObjectAsset;
}
uint32 UQuestActor_Factory::GetMenuCategories() const
{
return EAssetTypeCategories::Blueprint;
}
bool UQuestActor_Factory::ShouldShowInNewMenu() const
{
return true;
}
I followed the very few tutorials there are out there on this, and it worked: the asset shows up as its own thing in the content browser, and you can create and name it and save it, but when you try to open it it crashes the engine with this:
Assertion failed: ActorInfo.SharedWorld [File:D:\Build++UE4\Sync\Engine\Source\Editor\UnrealEd\Private\AssetSelection.cpp] [Line: 136]
And I can’t find anywhere that explains to me what this is. Can anyone help me?
(As an aside, if i attach the VS debugger to the engine it throws an “unhandled exception” without any specification to where that is, but if I click continue it actually opens the asset as normal)