First you need a special trait for the unit design, make one up but they all need it. Then add this
<Provides>This unit costs 1 Testres per member</Provides>
The above makes it require 1 Testres per member when you train, and it will continuously drain that resource as long as the unit lives (if damaged it still drains the max amount, ie 2/3 members alive = drain 3).
Then set up a new resource like below
<Description>Increases the power of your Fire spells.</Description>
<!-- AI Info -->
Then all you need is to add the production of the resource to somewhere. Here I added 3 production to each tower of dominion a player controls:
This would allow you to build 1 unit with 3 members (per tower of dominion), but nothing else. As long as the unit is alive, you can't build another one.