This is an old revision of the document!
⇐ Index
SetUnitDebugText(<-unit <-text)
Sets a text to appear above a unit.
This text can be used instead of, or in conjunction with SetObjText to display some text above a unit. It is directly attached to the unit and cannot be re-positioned. Although being labeled as “debug”, it can be used in non-editor gameplay. For example, the game uses it to display the out-of-ammo message for the Airship.
Both this API and SetObjText have access to all compatible formats in CW4. If you plan to resize the text, you will need to use the format “<line-height=[Insert number]>” as this type of text will not scale it's line-spacing correctly with the change in text size. Typically; “<line-height=100%>” solves this problem very reliably for using “<size=8>” which is a neat size. Just be sure to either limit the line-width by adding “<br>” to create new lines or limit the left line-margin using “<margin-right=[Insert number]>”.
The full list of formats in CW4 can be found in the A.D.A. Message editor format guide.
The text displayed by SetUnitDebugText is cleared upon game reload. If needed, it is recommended to re-apply the text display inside the :Awake function.
SetUnitDebugText(Self "text goes here")