Download

Error This blueprint (self) is not a %classnam%, therefore ' Target ' must have a con

Getting error:

Error This blueprint (self) is not a %classnam%, therefore ’ Target ’ must have a connection

Things i did:

  1. made new class based on actor
  2. made custom function in my new class, source files contain:

SteamClass.cpp



#include "TestSteamSimple.h"
#include "SteamClass.h"

USteamClass::USteamClass(const class FPostConstructInitializeProperties& PCIP)
	: Super(PCIP)
{
}

void USteamClass::happy_SteamInit()
{
	UE_LOG(LogTemp, Warning, TEXT("test"));
}


SteamClass.h



#pragma once

#include "TestSteamSimple.h"
#include "SteamClass.generated.h"


UCLASS()
class TESTSTEAMSIMPLE_API USteamClass : public UObject
{

	GENERATED_UCLASS_BODY()

	UFUNCTION(BlueprintCallable, category = Steam)
	void happy_SteamInit();
};


  1. in level blueprint add “event begin play”
  2. next to event add my custom function happy_SteamInit (for not clear reason to me it have blue pin containing “self” as target)
  3. when try compile blueprint get error above, so how can i get reference to my SteamClass or remove that target requirement since i want try to call Steam_Init which don’t need any object (at least didn’t in raw console template project in visual studio)?

But your code says you’re inheriting from UObject, not AActor. Can you explain what you’re trying to do here?

wops, copied from wrong project

this one is right

TestClass.cpp



#include "TestSteamSimple.h"
#include "TestClass.h"


ATestClass::ATestClass(const class FPostConstructInitializeProperties& PCIP)
	: Super(PCIP)
{

}

void ATestClass::happy_SteamInit()
{
	UE_LOG(LogTemp, Warning, TEXT("test"));
}


TestClass.h



#pragma once

#include "GameFramework/Actor.h"
#include "TestClass.generated.h"

/**
 * 
 */
UCLASS()
class TESTSTEAMSIMPLE_API ATestClass : public AActor
{
	GENERATED_UCLASS_BODY()

	UFUNCTION(BlueprintCallable, category = Steam)
	void happy_SteamInit();
};


I try make custom function call from blueprint to access steam functions.

Error exactly:

Error This blueprint (self) is not a TestClass, therefore ’ Target ’ must have a connection

The Blueprint needs to inherit from ATestClass if you want to access that happy_SteamInit() function. Earlier you mentioned you are trying to do this from a level blueprint? That’s probably the reason. Make a new Blueprint that inherits from ATestClass and call that function in there. Of course then you’ll have to place that BP into the level or use it by setting the default pawn in World Settings, otherwise this will never run.

I still have no clue what the hell you’re trying to do here :smiley:

i’m trying get access to steam function after enabling online subsystem steam, is here any better way i should use?

Afraid I have absolutely no clue about that.

I got the same error today.
In 4.5, i made a macro to make a calculation for reloading a gun. It has variable inside, that’s why i didnt make a function. But today i got to switch to 4.6, and now it’s broken. As soon as the macro gets executed, i get this error. Really driving me crazy…