BlzSetUnitName

Parameters
whichUnit unit
name string
comment

Change individual unit's name at runtime. Applies immediately.

Example (Lua, 2.0.2):

u1 = CreateUnit(Player(0), FourCC("hfoo"), -30, 0, 90)
BlzSetUnitName(u1, "Unit One")

-- restore localized name based on unit type:
u1rawcode = GetUnitTypeId(u1)
BlzSetUnitName(u1, GetObjectName( u1rawcode ))
note

See: GetUnitName, GetHeroProperName, GetDestructableName, GetItemName, GetObjectName.

patch

1.29.2.9231

Source
common.j (suggest an edit or discuss on Github)
return type
nothing
Source code
native BlzSetUnitName                              takes unit whichUnit, string name returns nothing