Types Sample
A spawner whose enemy type and wave pattern are picked in the Inspector, without touching code.


A wave of regular and elite enemies moves toward the center.
Open it
- Import the sample: Tools → Aspid 🐍 → FastTools → Welcome → Samples → Import on Types.
- Open
Scenes/Types.unityand enter Play Mode: every six seconds eight enemies appear in a circle, every fourth one anArmoredGrunt, and walk to the center.
Try
Exit Play Mode and select Enemy Spawner.


Enemy types and spawn pattern in the Inspector.
- A type that survives a rename. Enemy Type is a
SerializableMonoScript<Enemy>. RenameGrunttoFootmanin the code, the file and its.meta, so thatArmoredGruntfollows: after the recompile the field showsFootman. - A dependent picker. Elite Type offers only the class in Enemy Type and its subclasses. Switch Enemy Type to
Archerand open Elite Type: onlyArcheris left. - Names, groups and icons. Open Pattern: Circle and Line sit in the Spawn Patterns group with icons from
[TypeSelectorDisplay], and theHiddenOriginPatternis left out. Pick Line and enter Play Mode: the enemies start in a line. - Swap a component in place. Select Placed Enemy (swap its type) and set Health to
250. In theComponentTypeSelectordropdown at the top of its Inspector, switchArchertoGrunt: Health stays250, and Keep Distance, which onlyArcherhas, is gone.
Where to look
| File | Shows |
|---|---|
Scripts/EnemySpawner.cs | SerializableMonoScript<T>, SerializableType<T> and [TypeSelector] that follows another field |
Scripts/Enemies/Enemy.cs | The ComponentTypeSelector field |
Scripts/Spawning/ | [TypeSelectorDisplay] names, groups and icons, and [Preserve]: a pattern is stored only by its name, so without it managed code stripping removes the class from a player |
Reference: Serializable Types, TypeSelector and ComponentTypeSelector.