BlzGetUnitZ

Parameters
whichUnitunit

Target unit, may be alive or dead.

comment

Returns the surface elevation at unit's current location, including water surface and walkable destructables, plus the unit's occluder height (Z-axis in Cartesian System).

Returns 0.0 if unit was removed or is null.

note

The occluder height is added even if negative, lowering the sum in that case.

note

Terrain height is not synced between clients in multiplayer, because it relies on ray intersection of the to-be-rendered visuals (sprites). Operating on Z values will lead to desyncs if something beyond visuals is affected.

note

Same as BlzGetLocalUnitZ and practically GetLocationZ.

note

Since unit extends from widget, you can use widget-related functions too. See: GetUnitX, GetUnitY, GetWidgetX, GetWidgetY, GetLocationZ.

async
This function is asynchronous. The values it returns are not guaranteed to be the same for each player. If you attempt to use it in an synchronous manner it may cause a desync.
patch

1.30.0.9655

Source
common.j (suggest an edit or discuss on Github)
return type
real
Source code
native BlzGetUnitZ                                 takes unit whichUnit returns real