I’ve noticed recently that in many cases when I am developing a system, I will use a SceneComponent attached to an actor.
When I go to debug my work, the “Component” aspect of my class names gets inexplicably truncated off, leaving me in a very confused place.
This just recently happened with this snippet:
FName HitComponent = HitOut.Component->GetFName();
if (HitOut.Component->IsA(UInteractionWidget::StaticClass()))
{
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Cyan, FString::Printf(TEXT("!!!!!!!!!!!!!!!!! Component is: %s"), *HitComponent.ToString()));
}
else
{
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Cyan, FString::Printf(TEXT("Component is: %s"), *HitComponent.ToString()));
}
Now, the else block will print “Component is: Interaction Widget”! Because the component that it is hitting is a UInteractionWidgetComponent.
So I was dealing with code that would check if the hit component was an InteractionWidget, which would return false and then tell me what it was an InteractionWidget.
All because “Component” is truncated off of names. Not helpful.
Now I have team members asking me if they can name things “InteractionWidgetComp” or worse, “InteractionWidgetModule” just so they can get around this implementation.
Please stop truncating class names.