[BUG] Runtime engine strips spaces from actor's names

Hi,

I noticed that at runtime UE strips spaces in Actor names. I do a get all actors to find all player starts, which are named “Player StartX”, where X goes from 1 to 4.

In editor, if I get actor display name it returns e.g. “Player Start1”, which is expected behaviour.

However, at runtime (i.e. when game is built to a standalone), actor names will be stripped of spaces, e.g. “PlayerStart1”.

Attached is a small repro.

Platform: OS X & Win

Version: 4.7.4

Repro Steps:

  • Open Level map
  • Hit play, notice how it writes that length is 13, and when it tries to get a substring of index 12 with 1 length it returns 1 to 4.
  • Build game for windows
  • Run it, notice how it will print actor name withtout space and that length is 12, and it incidently it fails to print last character like in editor.

Regards,

Nuno Afonso

Hi nafonso,

Thanks for test project! I was able to reproduce this in 4.7.5 as well as our internal build, so I’ve entered a bug report for issue (UE-13580). When I see any progress on it, I’ll update this post. Thanks again!

As mentioned in comment for GetDisplayName, it returns a different thing for cooked games versus editor builds, and shouldn’t be used for keying or other applications that need a stable name. It’s really designed for use with debug printing / during development to give you a more friendly name than object name. actor label it is pulling from in editor mode doesn’t exist at all in cooked game.

I’ve exposed a GetObjectName in CL# 2518476, which will be stable across both cooked and non-cooked builds for things that don’t autogenerate their names (e.g., stable for statically placed actors or C++ constructed components but not stable for AddComponent nodes in a UCS, transient objects created using NAME_None, etc…). If you need a name to display to end user, you should use a FText variable instead of either one of these methods, so it can be localized.

Cheers,
Noland