Get actor name without "_C"

Hi,

How do i display an actor’s class name without the “_C” appended to it? I store an actor’s class as part of the information saved for a quest because I need to compare the enemy that a player just killed to the enemy type on their quest to see if it can increment the kill count for that quest. I would like to display the enemy’s name in the UI and figured it made the most sense to display the class’s name. However, using “getDisplayName” displays the class with “_C” that the engine tacks on.

Hey Mattapato,

The _C is added because the Actor is created from a generated Blueprint class. With that said, there isn’t a way to remove it. It is always going to be added by the engine with that object is created from that class.

What I suggest is to give your Enemy player a “Name” variable and instead of using GetDisplayName, use the variable you gave it with the name you give it. This way you won’t have to worry about _C and you have more control over the name.

Hey, thanks for the reply. I am storing a class and not a reference, is there a way to set a variable as “final static” via blueprints? I’d like to avoid spawning an actor just to read that name variable. Thanks!

I’m not sure I understand. Do you mean having a Actor that has a subclass of another class that is pulling a name from?

Can you break down what you are doing in more detail?

Thanks.

Have you developed these enemies with different blueprints/classes than other enemies?

If all of the enemies your player needs to kill have the same class and the class is not shared by other enemies, you can check against their class. In blueprints (sounds like that’s what you’re using), you can use the “Class is Child Of” node:

Unfortunately, if you’re using a generic enemy class for all of your enemies, this probably will not help.

You can use ‘‘left chop’’