Use this guide to create or edit a Tower prefab with all required TowerView references and team visual pools.
Architecture Context
TowerView inherits from BuildingLevelStackView.
That means visuals are built from three team-based pool arrays:
- "_foundationPools"
- "_levelsPools"
- "_roofPools"
Tower levels are represented by pooled stacked parts.
Unlike BuildingLevelObjectsView-based buildings, TowerView does not use "_buildingLevels".
Pre-Setup Checklist
- Root object has TowerView component
- "_localTransform" is assigned
- "_aimNode" is assigned
- "_foundationPools" has entries for all teams
- "_levelsPools" has entries for all teams
- "_roofPools" has entries for all teams
- "_levelMax" matches gameplay config
- "_unitsCountDefault" and "_unitsCountMax" allow reaching expected levels
Scene View Gizmos (BuildingView)
- BuildingView draws a wire sphere in the Scene view at this object transform position.
- Radius matches TargetView "_radius" (same footprint used for clicks and combat checks).
- Wire color matches "_teamID" so you can scan team placement in the editor.
- Turn on Gizmos in the Scene view toolbar if you do not see it.
Main Procedure
Step 1: Duplicate a Working Prefab
- Duplicate Assets/GorodiskiGames/TowerClash/ResourcesStatic/Prefabs/Building/Tower.prefab.
- Rename the new prefab, for example TowerVariant.prefab.
- Open the duplicated prefab in Prefab Mode.
Step 2: Verify Required Hierarchy Links
2.1. Confirm these object references in TowerView:
- Transform (visual root) -> "_localTransform"
- AimNode -> "_aimNode"
2.2. Confirm helper hierarchy groups exist under local transform:
- Foundations
- Levels
- Roofs
2.3. If required references are null, stack visuals and level presentation will break.
Step 3: Configure Core Building Values
3.1. Set gameplay-related values in TowerView:
- "_building" = Tower
- "_teamID" = default team for initial state
- "_radius" = click/target footprint
- "_foundationHeight" and "_levelHeight" = stack vertical spacing
- "_unitsCountDefault", "_unitsCountMax", "_levelMax" = gameplay limits
3.2. Important consistency rules:
- Keep "_levelMax" aligned with gameplay config
- Keep "_unitsCountMax" high enough to reach max level during gameplay
Step 4: Configure "_foundationPools"
4.1. Add one TeamPoolEntry per TeamIDType:
- Player
- Neutral
- Red
- Yellow
- Green
- Violet
- Magenta
- Cyan
4.2. For each entry, assign a ComponentPoolFactory that spawns the team-specific foundation prefab.
4.3. Rules:
- Do not leave a team missing
- Do not duplicate team IDs
Step 5: Configure "_levelsPools"
5.1. Add one TeamPoolEntry per TeamIDType.
5.2. Assign level segment prefabs for each team.
5.3. Runtime creates floor segments from this pool as level grows.