Download

why custom C++ methods have target pin and they can't be empty?

hi, after making custom class based on any other class i can get access to my exposed method in blueprints, but every such method seems always have blue “target” pin and blame me with message

“This blueprint (self) is not a %s, therefore ‘@@’ must have a connection.”

if i leave it empty, i found that massage comes from engine source at

…\Engine\Source\Editor\KismetCompiler\Private\KismetCompiler.cpp

1091 line

if(PinType.IsEmpty()) { ErrorMsg = FString::Printf(*LOCTEXT(“PinMustHaveConnection_NoType_Error”, “’@@’ must have a connection.”).ToString()); } else { ErrorMsg = FString::Printf(*LOCTEXT(“PinMustHaveConnection_WrongClass_Error”, “This blueprint (self) is not a %s, therefore ‘@@’ must have a connection.”).ToString(), *PinType);
}

in this case i have few questions very confusing me:

why and what for all (or not?) custom C++ methods have that target blue pin?

can i avoid/trick that target pins with something the same without needs to search every time?

if there isn’t easy ways, what common ways to avoid that target pin problem?

As far as I remember, I get the same message, if I edit the .cpp parent of a Blueprint and compile it. The editor then seems to have a problem with kind of not finding the hot reload file correctly. Have you tried restarting the editor and maybe refreshing the blueprint nodes afterwards?

yeah, i always restart editor, because hot reload cause too much problems, but no, it’s not the reason, here it is:

friend knowing C++ very well explained to me, that method can avoid dependance on object with static declaration like

static void Myfunc() in .h file

but static keyword doesn’t mean function always must be outside any classes, in my .h i still keep

#pragma once
#include “Engine/Blueprint.h”
#include “Steam_Bluprint_Functions.generated.h”

UCLASS()
class STEAM_TRAINING_API USteam_Bluprint_Functions : public UBlueprint
{
GENERATED_BODY()

UFUNCTION(BlueprintCallable, Category = "Steam")
static bool CreateLobby();

};

but just static caused futher problem because i miss “public” keyword, this is what UE editor blueprint says then

so the fix would look like this in .h

#pragma once
#include “Engine/Blueprint.h”
#include “Steam_Bluprint_Functions.generated.h”

UCLASS()
class STEAM_TRAINING_API USteam_Bluprint_Functions : public UBlueprint
{
public:
GENERATED_BODY()

UFUNCTION(BlueprintCallable, Category = "Steam")
static bool CreateLobby();

};

now funcs compile fine in blueprints