Using the official tutorial and a number of other variations of implementation UTextRenderComponent can be implemented, compiled and successfully executed using C++ but Visual Studio warns me that the functions of this component are inacessible, underlines them in red* and refuses to reveal the functions.
[*In the following example specifically the keywords “SetText” and “SetRenderColour” are underlined as being inaccessible]
This occurs regardless of includes, of which I am currently using the following in the .cpp
#include "Components/TextRenderComponent.h"
#include "Engine/TextRenderActor.h"
#include "Components/TextBlock.h"
This occurs regardless of forward declaration ‘class’ variations also.
void AGameop::BeginPlay()
{
Super::BeginPlay();
FVector Location(-5.0f, -43.0f, 130.0f);// X / Y / Z
FRotator Rotation(0.0f, 180.0f, 0.0f); // X / Z / Y
FActorSpawnParameters SpawnInfo;
SpawnInfo.SpawnCollisionHandlingOverride = ESpawnActorCollisionHandlingMethod::AlwaysSpawn;
TextDisplay = ()->SpawnActor<ATextRenderActor>(Location, Rotation, SpawnInfo);
TextDisplay->GetTextRender()->SetText(_displayText);
TextDisplay->GetTextRender()->SetTextRenderColor(FColor::Green);
TextDisplay->SetActorScale3D(FVector(0.3f));
TextDisplay->AttachToComponent(SceneComponent, FAttachmentTransformRules::KeepRelativeTransform);
}
As I say. The code works. You can update the text dynamically without issue also. It is simply that the compiler complains and wont show you the available functions.
In addition, possibly a separate issue, possibly related, the axes of rotation and location modify in a different order to that expected. The axes are as noted in the comments of the above code.
Although I’m tagging this as a bug report I could be completely wrong and could be implementing this wrongly somehow. I’m very experienced in C++ but still a beginner with UE4, so advice welcomed.