First, find the building in the proto(x). Let's say we wanted to add it to the Academy.
(unit id="422" name="Academy")
(dbid)2211(/dbid)
(displaynameid)17925(/displaynameid)
(icon)icon building barracks(/icon)
(maxcontained)5(/maxcontained)
(initialhitpoints)1200.0000(/initialhitpoints)
(maxhitpoints)1200.0000(/maxhitpoints)
(los)9.00......
Scroll down to the part of the unit that goes like this:
(train row="0" page="1" column="0")Hoplite(/train)
(train row="0" page="1" column="1")Roman Legionairus(/train)
(train row="0" page="1" column="2")Hypaspist(/train)
Now add a new train row:
(train row="0" page="1" column="3")My Unit(/train)
Now open the techtree.
Find the allowed age of your unit:
(tech name="Age 2" type="Normal")
Then just add your unit into the mix of 'obtainables'.
(effect type="Data" amount="1.00" subtype="Enable" relativity="Absolute")
(target type="ProtoUnit")My Unit(/target)
(/effect)