Hi,
I’m trying to update a UTextRenderComponent component in code based on variables set by designers.
I’m registering to the selection callback as so:
USelection::SelectObjectEvent.AddUObject(this, &MyClass::OnObjectSelected);
void MyClass::OnObjectSelected(UObject* Object)
{
if (TextRenderComponent == nullptr)
{
TextRenderComponent = FindComponentByClass<UTextRenderComponent>();
}
if (Object == this)
{
if (TextRenderComponent)
{
// Convert Enum into Text
FString flags = GetStringFromDesignerFlags();
FText string = FText::FromString(flags);
TextRenderComponent->SetText(string);
}
}
else
{
if (TextRenderComponent)
{
FText string = FText::FromString("");
TextRenderComponent->SetText(string);
}
}
}
Unfortunately this only updates once and afterwards fails to update on subsequent selections.
it looks like it’s failing in:
void UActorComponent::MarkRenderStateDirty()
as bRenderStateCreated is false.
Can you shed any light on this please?
Cheers,
Chris