Download

Native deferred attachment help with custom components

I am trying to follow https://wiki.unrealengine.com/Actor_Components,Making_Native%26_Deferred_Attached_to_Socket in order to attach some custom components I have written to their sockets.

UVRItemAcceptor inherits UVRInteractionComponent which inherits USkeletalMeshComponent.

From the headers of my components


UCLASS()
class UVRItemAcceptor : public UVRInteractionComponent
{
	GENERATED_UCLASS_BODY()
};

UCLASS()
class UVRInteractionComponent : public USkeletalMeshComponent
{
	GENERATED_UCLASS_BODY()
}


In my VRCharacter.h


UPROPERTY(VisibleAnywhere, Category = "Inventory Components")
		TSubobjectPtr<UVRItemAcceptor*> Chest1;

EDIT:

Should be


UPROPERTY(VisibleAnywhere, Category = "Inventory Components")
		TSubobjectPtr<UVRItemAcceptor> Chest1;

In my VRCharacter.cpp



Chest1 = PCIP.CreateDefaultSubobject<UVRItemAcceptor>(this, TEXT("Chest1"));
Chest1->AttachParent = Mesh;
Chest1->AttachSocketName = FName(TEXT("Chest1_Socket"));


The last 2 lines have red squiggly under Chest1 and claim expression must have a pointer to class type. Does anyone know why this is? Have I messed up something when making my new component types?

Did you include your header file for your component so that your character class knows about it?


#include "VRItemAcceptor.h"
//your character .h generated below


:slight_smile:

Rama