For a single unit frame, you inherit SecureUnitButtonTemplate, attach statusbars, fontstrings, etc to that frame, and then register and react to events to reflect what's happened.
The most basic unit frame:
local f = CreateFrame("Button","BeNiceAndNameYourUnitFrames",UIParent,"SecureUnitButtonTemplate")
f.unit = "player" -- change to unit you want to track
-- background texture
f.back = f:CreateTexture(nil,"BACKGROUND")
-- health statusbar
f.hp = CreateFrame("StatusBar",nil,f,"TextStatusBar")
-- name fontstring
f.name = f:CreateFontString(nil,"ARTWORK","GameFontHighlight")
-- updates the status bar to new health
local function update(self)
local unit = self.unit
update(f) -- do an initial update
This will create a very basic unit frame for "player" in the middle of the screen.
If you want it for party1-4 or raid1-40 and you want one for each unit, then the above is just the tip of the iceberg. You need to set up a RegisterUnitWatch to show/hide them (can't do that in combat with a simple :Show() and :Hide()). You need a mechanism for placement. Do you reuse frames for party vs raid or separate? Will you precreate all frames so people joining the party/raid will appear in combat? Also right-click menu support, maybe other information like class as an icon or colored bars. Support for dead/disconnected players. There's a ton of stuff to consider.
Please report any Code of Conduct violations, including:
Threats of violence. We take these seriously and will alert the proper authorities.
Posts containing personal information about other players. This includes physical addresses, e-mail addresses, phone numbers, and inappropriate photos and/or videos.
Harassing or discriminatory language. This will not be tolerated.