// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "Kismet/BlueprintFunctionLibrary.h"
#include "CreateBlueprint.generated.h"
/**
*
*/
UCLASS()
class YOUR_API UCreateBlueprint : public UBlueprintFunctionLibrary
{
GENERATED_BODY()
public:
UFUNCTION(BlueprintCallable, Category = "NodesToScript")
static UBlueprint* CreateBlueprint(FString BlueprintPath, TSubclassOf<UObject> ParentClass, bool& bOutSuccess, FString& OutInfoMessage);
};
// Fill out your copyright notice in the Description page of Project Settings.
#include "CreateBlueprint.h"
UBlueprint* UCreateBlueprint::CreateBlueprint(FString BlueprintPath, TSubclassOf<UObject> ParentClass, bool& bOutSuccess, FString& OutInfoMessage)
{
//TSubclassOf<class UBlueprint> targetBP;
static ConstructorHelpers::FObjectFinder<UBlueprint> myBlueprint(*BlueprintPath);
UBlueprint* targetBP = myBlueprint.Object; //->GeneratedClass;
return targetBP;
}
Shows up no problem but static ConstructorHelpers::FObjectFinder
can’t be used outside of a constructor and it crashes the engine. A lazyload would work but it needs a softpointer