Thread Tools Display Modes
Yesterday, 07:29 PM   #1
nilo
Join Date: Feb 2022
Posts: 16
Question How to append textures to unitframes?

Helloo
I'm a begginer at addon dev and have a question
I have this code that displays on screen an icon representing the role of each member in the group, now I'm trying to figure out how to append the icons to the default group frames.

Code:
function Test()
    for i = 1, GetGroupSize() do
        local unitTag = GetGroupUnitTagByIndex(i)
        local unitFrame = UNIT_FRAMES:GetFrame(unitTag)
        d(unitFrame)

        local frameName = "TestFrame" .. i

        local GroupMemberFrame = WM:CreateTopLevelWindow(frameName)
        GroupMemberFrame:SetDimensions(25, 25)
        GroupMemberFrame:ClearAnchors()
        GroupMemberFrame:SetMouseEnabled(true)
        GroupMemberFrame:SetMovable(true)
        GroupMemberFrame:SetHidden(not LGRI.savedVars.visible)
        GroupMemberFrame:SetClampedToScreen(true)
        GroupMemberFrame:SetHandler("OnMoveStop", function() getPos() end)

        GroupMemberRoleIcon = WM:CreateControl(frameName .. "Teste" .. i, GroupMemberFrame, CT_TEXTURE)
        GroupMemberRoleIcon:SetDimensions(25, 25)
        GroupMemberRoleIcon:SetAnchor(CENTER, GroupMemberFrame, CENTER, 0, 0)
        GroupMemberRoleIcon:SetTexture(Group[i].RoleIcon)
        
        GroupMemberFrame:SetAnchor(TOPLEFT, GuiRoot, TOPLEFT, 250, 100 + (i * 40))
        
    end
end
I've tried this but it crashes the game for some reason
Code:
GroupMemberFrame:SetAnchor(TOPLEFT, unitFrame, TOPLEFT, 0, 0)
  Reply With Quote

ESOUI » Developer Discussions » Graphics Help » How to append textures to unitframes?


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off