Hi, im trying to spawn an actor from c++.
I’ve used a SClassPropertyEntryBox in a module to let the user select a Blueprrint they want to spawn. The code looks like this:
+ SVerticalBox::Slot()
[
SNew(SClassPropertyEntryBox)
.MetaClass(AActor::StaticClass())
.OnSetClass(FOnSetClass::CreateSP(this, &FTestEditorEdModeToolkit::OnSetClass))
.IsBlueprintBaseOnly(true)
];
void FTestEditorEdModeToolkit::OnSetClass(const UClass* TheClass)
{
PathToActor = TheClass->GetPathName();
NewClass = TheClass;
UE_LOG(LogTemp, Log, TEXT("SELECTED CLASS"));
}
The delegate OnSetClass provides a const UClass * reference to the selected class in the PropertyEntryBox.
This is a problem since the function World()-SpawnActor does not accept a const UClass *, but rather a non const.
Are there any solutions to this that is not an “ugly” solution?
Cheers!