I can’t get make a custom blueprint node to save my life.
It should be as simple as: #include “Kismet/BlueprintFunctionLibrary.h”
UFUNCTION(BlueprintCallable)
static UBlueprint* CreateBlueprint(FString BlueprintPath, TSubclassOf ParentClass, bool& bOutSuccess, FString& OutInfoMessage);
And dozens of other variations from tutorials. It simply won’t show up. I’ve rebuilt each time, tried live coding, tried shutting down and restarting editor… Just refuses to add a custom node.
Help please. 12 hours just trying to make a simple node appear on a graph. -_-
// 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
The function creates a blueprint… but I haven’t gotten far enough to test the function… because I can’t get the function to even appear as a node in blueprints.
So, trying the same thing over and over, I finally got an empty function to show up in the library.
Still can’t get the full function to show up. But, at least I get an error now while “live loading”. No error in VS… but CTR->Alt->F11 to compile in UE gives a link error.
In .cpp: #include “NewBlueprintFunctions.h” #include “AssetRegistry/AssetRegistryModule.h” #include “KismetCompilerModule.h” #include “Kismet2/KismetEditorUtilities.h”
in Build.cs:
PrivateDependencyModuleNames.AddRange(
new string[]
{
“Projects”,
“InputCore”,
“EditorFramework”,
“UnrealEd”,
“ToolMenus”,
“CoreUObject”,
“Engine”,
“Slate”,
“SlateCore”,
“AssetRegistry”,
“KismetCompiler”,
// … add private dependencies that you statically link with here …
}
);
KismetEditorUtilities are part of Module UnrealEd.
Direct copy and paste and still get error:
error LNK2019: unresolved external symbol "__declspec(dllimport) public: static class UBlueprint * __cdecl FKismetEditorUtilities::CreateBlueprint
I’ll start from scratch… again. Keep doing the exact same thing… and somehow I’m closer than when I started… but still not as close as when someone else does the exact same thing. -_-
Deleting those folders wrecked the project entirely. Unsalvagable.
Rebuild failed, “Solution” file broken, editing the .cpp files directly had no effect.
Luckily, not a big deal, as it was a scratchpad project.
Started new project, everything works. Creates the BP as expected. Now I just have to figure out the C++ command to add nodes to exist blueprints.
the solution file can also be deleted (*.sln) it is regenerated in the process.
I’ve done this hundreds of times and can do do it in my sleep at this point
.vs
binaries
saved
Intermediate
DerivedDataCache
the sln file
the .vsconfig file
I’ve been building projects for over 8 years at this point.
Never delete the following
Source (this is where your c++ files live)
Content (your game folder)
Config
Platforms
your main Uproject file needed for regeneration
Make sure that at any time you are creating any .cpp or .h files that they aren’t saved into Intermediate by accident!.
It can be a common error of inexperienced coders that don’t notice visual studio saving there.
Intermediate is a temp directory and none of your project files header or cpp should be there. Their place is in source.
“I’ve done this hundreds of times and can do do it in my sleep at this point”
This speaks volumes. It’s really sad their system is so buggy that this is an actual thing.
I go back and forth between having 10,448 errors (in a brand new file), to 14… and it runs fine with the 14. When it has 10k+ I can’t even function. Intellisense just breaks and I have no idea what to type. Or what I do that makes them magically vanish…