Opponents must pay X each time they would target this with a spell or ability.
This has nothing to do with attacking. Opponents don't have to pay to attack something with resist, they only have to pay to target it with spells or abilities. — SirlinThis does stack, so if one of your units gets resist 1 twice, opponents must pay 2 gold to target it with spells or abilities. — Sirlin