Hello everyone,
I m trying to create a custom component containing a capsule and a textRender component and give it to a random actor.
here is my header
UCLASS(ClassGroup = (Custom), meta = (BlueprintSpawnableComponent))
class TEST_API UStealComponent : public USceneComponent
{
GENERATED_BODY()
public:
UStealComponent(const FObjectInitializer& ObjectInitializer);
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Steal)
UCapsuleComponent* BaseColisionTrigger;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Steal)
class UTextRenderComponent* text;
};
and here is my CPP
UStealComponent::UStealComponent(const FObjectInitializer& ObjectInitializer)
: Super(ObjectInitializer)
{
BaseColisionTrigger = ObjectInitializer.CreateDefaultSubobject<UCapsuleComponent>(this, TEXT("InteractionCapsuleTrigger"));
BaseColisionTrigger->AttachTo(this);
BaseColisionTrigger->bGenerateOverlapEvents = true;
text = ObjectInitializer.CreateDefaultSubobject<UTextRenderComponent>(this, TEXT("texte"));
text->SetText(FString::Printf(TEXT("Press Q to Steal")));
text->TextRenderColor = FColor::White;
static ConstructorHelpers::FObjectFinder<UFont>HUDFontOb(TEXT("/Engine/EngineFonts/RobotoDistanceField"));
text->Font = HUDFontOb.Object;
text->AttachTo(this);
}
In the blueprint of the actor i am able to add and modifies my custom component.
ex: transform, visibility, replication…
However once i run the game, the component is in its default state (no modification of transform, visibility, replication etc).
Do i need to do something else in order for the change to take effect? Did i do something wrong?
Thanks in advance.
EDIT:
hello again!!!
here is pictures that detail a bit more my problem:
here is my actor in the blueprint editor with the component by default
here is my actor in the blueprint editor with the component modified how i want it
here is my actor in the level
and here is what happen when i run the game
Im using 4.7. I tried it in 4.6.1 and it works perfectly. Still no idea why its doing this. Is anyone having this problem?