I am trying to call a function I created in a new c++ class, but it seems that the function can’t be seen. The type of the new c++ class is blueprint function library. And here is the code:
//PortalFunctionLibrary.h
#pragma once
#include "CoreMinimal.h"
#include "Kismet/BlueprintFunctionLibrary.h"
#include "Engine/TextureRenderTarget2D.h"
#include "PortalFunctionLibrary.generated.h"
/**
*
*/
UCLASS()
class DEMO_API UPortalFunctionLibrary : public UBlueprintFunctionLibrary
{
GENERATED_BODY()
public:
UFUNCTION(BlueprintCallable, Category = "PortalFunctionLibrary")
static void ResizeRenderTarget(UTextureRenderTarget2D* render_target, float size_x, float size_y);
};
//PortalFunctionLibrary.cpp
#include "PortalFunctionLibrary.h"
void UPortalFunctionLibrary::ResizeRenderTarget(UTextureRenderTarget2D* render_target, float size_x, float size_y)
{
if (render_target == nullptr)
return;
render_target->ResizeTarget(size_x, size_y);
}
After coding, I use “DebugGame Editor” to launch the UE 5 editor and try to call function “ResizeRenderTarget” by adding node in event graph. But it can’t be found.
Also, after I creat a new c++ class(blueprint function library), the .cpp and .h files will be opened in a new solution with nothing. I have to open the .sln file in my project folder to write the codes above. I wonder if they’re related.