Why is there another object name in game?

When I pick up a pistol in editor preview it prints “P_Glock” but in packaged project it prints me “P_Glock_GEN_VARIABLE_P_GLOCK_C_CAT_2147482498”. Why? (The object name saves in HeldItem variable)




This is very normal. The names of object can vary enormously, and you can’t rely on them for comparison.

It’s what casting is for, to check the type of an item.

1 Like

The answer to “why” there are different names, is to support various concerns like multiplayer, object duplication, re-spawning, save games, and so on.
Objects are given a constructed name when they’re spawned, where the construction makes sure the name is unique within the current game instance.

If you want to test for a specific object instance, either hold on to a reference of that object when spawning it (or when starting the game,) and compare to that instance, or give the object a particular tag that you can check for.