More Precise Naming For Error Message (Alternative to 'GetName()')

Hi, I recognise there is already a topic on this but I’d like to add a little bit more detail on a situation you may run into. Nothing major, just a small bit to know.
After creating your error message, take a look at the name shown by the value returned by ‘GetName()’
image
You may see that the name shown is not in your World Outliner. If not, you are still likely to come across this in the future. This is only a minor detail, and you can probably assume why the naming appears different.
0m3AqLAVdm
This is because each entity in the World Outliner has a label which can be easily changed and, as you hover over the label, an ID which is more set in stone. So I’ve changed the log message slightly.

		UE_LOG(LogTemp, Error, TEXT("%s (ID: %s) has the DoorRotation component attached, yet no defined PressurePlate."), *GetOwner()->GetActorLabel(), *GetOwner()->GetName());

This returns a log message which still shows the ‘GetName()’ value, which refers to the ID, but also shows the label, returned by ‘GetActorLabel()’, which you can easily find in the World Outliner should you evoke the error message and need to make a correction to the component of the door actor, rather than hovering over multiple actors to see which has the specified ID.

2 Likes

Naming is key!

1 Like

Privacy & Terms