Referencing a blueprint defined custom class..

Hi,

I’ve just started UE4 C++ programming, but am pretty used to standard C++. If I want to reference a custom class that I have defined in blueprints from a class I’m implementing in C++, how do I do it?

i.e. In C++ I would:
In [ThisClass.hpp] #include “OtherClass.hpp”, then to create a class pointer to it, in this class declaration define: OtherClass* OtherClassPtr;
I would then pass a reference to a specific instance of OtherClass to this class via the constructor or a PostInitBoot(OtherClass* OtherClassInstPtr) function.

Where I am at the moment, VS2013 auto-complete doesn’t list my custom classes (it finds the UE4 default types ok), and I can’t find any include file for my custom blueprint class (#include “MyCustomActor.hpp”) - is there another path location/UE4 project file I have to use/include? Or should I use one of the UE4 markup macros (e.g. UCLASS() - think I’ve got the basics of these)?

If possible could someone to post a quick code snippet? Any help would be great, many thanks…

Header


TSubclassOf<ClassName> ClassPtr;

.cpp File



AClass::AClass(const FObjectInitializer& ObjectInitializer)
	: Super(ObjectInitializer)
{
static ConstructorHelpers::FClassFinder<ClassName> ClassFinder(TEXT("**Path To File (IE: /Game/UI/HUD/BP_UI_HUD_PlayerInventory)**"));
	if (ClassFinder.Class)
		ClassPtr = ClassFinder.Class;
}


1 Like

Thanks,… :slight_smile: