How do I get the Text Render Component from C++, so I can change it dynamically?

I am trying to access the Text Render Components Text to change it dynamically from code. I don’t find something like that in the internet. Can I acces it in my Level with Getworld()->… and so on?

I hope somebody can help me!

Put this in your .h file:

    // display text render component
    UPROPERTY(VisibleInstanceOnly)
        UTextRenderComponent* _displayText;

Put this in your .cpp file class constructor:

    // create text render component with some default values
    FString unrealName = "TextIndicator";
    _displayText = CreateDefaultSubobject<UTextRenderComponent>(*unrealName);
    _displayText->SetText(FText::FromString("Text"));
    _displayText->SetTextRenderColor(FColor::Black);
    _displayText->SetXScale(1.0f);
    _displayText->SetYScale(1.0f);
    _displayText->SetHorizontalAlignment(EHorizTextAligment::EHTA_Center);
    _displayText->AttachTo(this);

SetText() changes the text at any time.

Thank you very much! It works!