How can i set the display name of a spawned object?

i have a tree that replaces itself. default name is tree1, but when it respawns, the name changes to tree2. i want to set the display name in the begin play for the actor. how do i do that?

1 Like

Do not rely on display name functions; Display names are used in Editor only and you can’t use display names for code in packaged game, it won’t work. If you are looking for objects in game by name and didn’t test in packaged shipped game yet, well… You’ve got some code to fix.

By the way, to change name you can simply edit the name on the Details panel.

thats not exactly what i was asking. and you didnt answer the question. i just want to set its name when begin play hits.

You can’t set an object’s display name by code because they are not used in gameplay code. Objects in game are identified by ID, not display names thus there’s no function to set an Actor’s display name in game code.

It would be helpful for debugging purposes to be able to modify the display name on spawn… Because the World Outliner displays dynamically spawned objects in it’s list.

So Making excuses why a function doesn’t exist is just making excuses.

Yeah, the name system in Unreal is beyond broken and useless. Even if it’s not used internally, for game logic programming it’s handy to use names if you are consistent in naming them. But we even can’t in blueprint.

With Blutility having more and more utility to spawn objects and do stuff editor time this problem is only growing.

Since all objects use id’s anyway, it would be trivial to add and keep track of an internal map that connects the id to the name right. That would even allow for equal names if you really wanted.

Are you sure you mean “display name”? Because if you mean the name in the world outliner (top right) I think that’s known as the actor label. That can be set in a blueprint using Set Actor Label.

2 Likes