This tutorial will help you set up your own unique add-on. You can likely use any model that you want when making an add-on but keep in mind that weird things can happen with the animations. But by all means, we can have a Spire add-on to a Starport if we wanted. Anything is possible.
First off, there's quite a few things to consider and components that need to come together in the Data Editor to make the custom add-on come to life without crashing your game. Make sure you have "Show Advanced Values" mode on. There are a couple parameters that are hidden from view without this mode toggled on. This among other things prevented me from finishing my custom add-on for quite a while.
1. The Button/Requirements: Like with everything else you want to make from scratch, you must give it a button that provides the add-on with its own tooltip. This is an easy step to handle yourself. Requirements can be set as well if you want to force the player to produce a certain structure before they can create the add-on. We'll revisit this later.
2. The add-on Actor: You're going to want to create your own copy of the Actor you are using, specifically reserved for the add-on you are making. Make sure you link this with the Unit you create with the Token parameters at the top called "unitName". If you duplicate an existing Actor, the animations might be messed up. This can cause invisible add-ons, add-ons that pop out of nowhere when they finish building (have no construction animation), or just plain freeze your game. The reason it does this is because you're requesting animations that don't exist. Duplicating can sometimes mess things up. You'll want to go into "Events - Events +" to fix this.
Check all the green fields, which are custom fields you have defined. Search for anything unusual (blank Source Name fields, references to sounds that don't exist like "Create SoundEmitter PhysicsLab_Ambience" or references to construction animations that don't exist like "UnitConstruction.PhysicsLab.Start > Create PhysicsLabBuild"), and change it to an existing model or sound. For example, this Tech Lab's Events I copied for my custom add-on. This should solve any problems with freezing, animation issues, etc.
3. The Unit: There are a couple important fields to fill out on your Unit's fields.
Behavior - Add On Offset X/Y: Sets where the add-on will be placed from the parent unit. Behavior - Added On Units +: Use this to create a link between your building and your add-on. This is a very important step. It references a Behavior and I don't know what it does, but it helps establish the relationship of the two units. I chose to duplicate the Behavior "Tech Lab - Starport", but any of those 3 will do. Only do this for your add-on, not the parent building. Abilities - Abilities +: Here you can place what abilities and actions you want your add-on to be able to take. There's an important ability you must use here if you want to be able to "morph" the add-on. You'll see it on the Tech Lab add-ons. It's called "Tech Lab Morph".
Note on Morphing: If you don't create morphing abilities for the add-on, it will not be disabled when detached from the parent. You don't ever notice it, but the detached Tech Lab is considered a separate unit, just like Tech Lab - Barracks/Starport/Factory. You can ignore the Morphing ability referenced throughout this guide if you don't care if the building functions unattached. However, you probably don't want the player to be able to use the add-on without its parent. Let's move on.
Movement - Pathing Footprint: Footprint 2x2 (Contour) is the default and you should use this for starting off. It affects how much space on the grid it takes up. If you know how to modify footprints, then you'll have to create a matching custom "Footprint 3x3 + 2x2 (Addon)" footprint for your custom footprint, should you choose to use something other than the default. Movement - Pathing Footprint - Placement: What footprint pattern you'll see if you are placing the add-on airborne (via Terran building Lift Off/Land).
4. The Detached Add-on The detached add-on is actually a separate unit and it isn't simply a "toggle on/off" button. The relationship between these two units must be handled as well. Create a duplicate of your custom add-on, and give it a (Detached) suffix so you can easily pick it out between the two add-ons. Remove everything from the "Command Card +" field except for cancel (you want players to be able to cancel the building while it's constructing). That's all you have to do here.
5. Requirements redux: If you haven't noticed while you were creating the custom add-on or requirements, there are a set of Tech Lab requirements that involve the Tech Lab Morph ability. There is one called "Show If Have Starport Add On Parent", etc. Duplicate this and modify the Requirements + to reflect your parent building.
6. The Abilities: Aside from the abilities you want it to have, there are a couple core abilities to work with for your add-on and parent building.
Parent Structure: xxxxx - AddOns Put this ability on the parent structure, adding your custom add-on to the list along with its button on the Command Card + field. Add-on: Tech Lab Morph (xxxxx) You'll actually need two of these. One handles the morph to detached add-on case. The other handles the morphing back to a functional add-on case. Don't mix these up. You need the working add-on to reference the detached add-on and vise versa. Just give one of these the (Detached) suffix. Under "Ability - Info +", set the Detached structure for the Detached add-on's ability. Set the functional add-on to the functional add-on's ability.
Make sure the Detached add-on has the "Produce" Flag unchecked. Now go to the "Ability - Commands +" and set the Execute Command to have the new Requirements you just set. Basically, you want the Requirements to reflect which add-on ability you have selected. Set the Detached add-on Requirement to be "Show If Have No Add On Parent". Give the custom add-on the other Requirement you have created for it.
7. The Units redux: Finally, give these new morphing abilities to the custom add-on and its detached twin version. You want the Detached version to have the ability to morph to the functional version and vice versa.
I hope I didn't leave anything out. :( You should now have a functional add-on exclusive for your structure that doesn't crash the game anymore. Yay! Using what you just learned, you can also create a multi-morphing Tech Lab like Blizzard's model, crazy add-on combinations, and more.
Have fun, doods.
Maybe this was better suited as a video tutorial...