2025-10-15 18:25:31 +08:00

31 lines
742 B
C++

// Fill out your copyright notice in the Description page of Project Settings.
#include "Factory/ShapeFactory.h"
#include "ProjectFish/DataAsset/ShapeAsset.h"
UShapeFactory::UShapeFactory()
{
SupportedClass = UShapeAsset::StaticClass();
}
UObject* UShapeFactory::FactoryCreateNew(UClass* Class, UObject* InParent, FName Name, EObjectFlags Flags, UObject* Context, FFeedbackContext* Warn)
{
UShapeAsset* NewBagShapeAsset = NewObject<UShapeAsset>(InParent, Class, Name, Flags | RF_Transactional);
if (NewBagShapeAsset)
{
NewBagShapeAsset->ShapeWidth = 5;
NewBagShapeAsset->ShapeHeight = 5;
NewBagShapeAsset->InitializeShape();
}
return NewBagShapeAsset;
}
bool UShapeFactory::ShouldShowInNewMenu() const
{
return true;
}