SpawnDecalAttached Not Working

When I use the function
UGameplayStatics::SpawnDecalAttached(bulletHoleDecal, FVector(5, 5, 5), object, NAME_None, hit.Location, hit.Normal.Rotation(), EAttachLocation::KeepRelativeOffset, 20);

Nothing happens, but when I just use SpawnDecalAtLocation it works fine.

I can’t get many of the functions in C++ to work like AddForce for instance.

Please help… What am I doing wrong?

Here is the whole thing. I’m trying to spawn an attached decal at the hitresult location.

FHitResult hit;

FVector startPosition = FirstPersonCameraComponent->GetComponentTransform().GetLocation();
FVector direction = FirstPersonCameraComponent->GetForwardVector();

const FName traceTag("fireLine");

World->DebugDrawTraceTag = traceTag;

FCollisionQueryParams params;
params.AddIgnoredActor(this);
params.TraceTag = traceTag;

World->LineTraceSingleByChannel(hit, startPosition, startPosition + direction * 100000, ECC_WorldDynamic, params);

if (hit.GetComponent() != NULL)
{
	UPrimitiveComponent * object = hit.GetComponent();

	UGameplayStatics::SpawnDecalAtLocation(hit.GetActor(), bulletHoleDecal, FVector(5, 5, 5), hit.Location, hit.Normal.Rotation(), 20);

	if (object->IsSimulatingPhysics())
	{
		object->AddForce(FVector(0, 0, 1000));
	}
}

Try to set the property ReceivesDecals to True in the attached component.

Since it’s working when you use SpawnDecalAtLocation I assume that your collision check is accurate.
For the SpawnDecalAttached approach, use EAttachLocation::KeepWorldPosition.

UGameplayStatics::SpawnDecalAttached( bulletHoleDecal, FVector(5.0f, 5.0f, 5.0f), hit.GetComponent(), NAME_None, hit.Location, hit.Normal.Rotation(), EAttachLocation::KeepWorldPosition, 20.0f );

Hope it works •ᴗ•

EDIT
Also, I recommend decreasing the decal X-axis scaling. Preferable to 1.0f since it will reduce some decal smearing.