Use this guide to create or edit an Artillery prefab with all required ArtilleryView references.
Architecture Context
FactoryView inherits from BuildingLevelObjectsView.
That means visuals are driven by:
- Team foundation visuals from "_foundationPools”
- Level object switching from "_buildingLevels”
In the current Factory prefab pattern:
- "_levelsPools" is empty
- "_roofPools" is empty
- Level look is selected by enabling one entry from "_buildingLevels”
Pre-Setup Checklist
- Root object has FactoryView component
- "_localTransform" is assigned
- "_aimNode" is assigned
- "_foundationPools" has entries for all teams
- "_buildingLevels" is filled in level order
- "_levelMax" matches number of supported levels
- "_unitsCountDefault", "_unitsCountMax" match gameplay config
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/Factory.prefab.
- Rename the new prefab, for example FactoryVariant.prefab.
- Open the duplicated prefab in Prefab Mode.
Step 2: Verify Required Hierarchy Links
2.1. Confirm these object references in FactoryView:
- Transform (visual root) -> "_localTransform”
- AimNode -> "_aimNode"
2.2. Confirm this visual structure exists under the local transform:
- Foundations group for team variants
- Level objects used by "_buildingLevels”
2.3. If required references are null, team setup or level switching will fail.
Step 3: Configure Core Building Values
3.1. Set gameplay-related values in FactoryView:
- "_building" = Factory
- "_teamID" = default team for initial state
- "_radius" = click/target footprint
- "_foundationHeight" and "_levelHeight" = vertical layout values
- "_unitsCountDefault", "_unitsCountMax", "_levelMax" = gameplay limits
3.2. Important consistency rules:
- Keep "_buildingLevels".Length >= "_levelMax"
- Keep "_unitsCountMax" high enough to reach expected levels 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 correct team foundation prefab.
4.3. Rules:
- Do not leave a team missing
- Do not duplicate team IDs
Step 5: Configure "_levelsPools" and "_roofPools"
5.1. In current FactoryView setup, keep both arrays empty.
5.2. Use these arrays only if you intentionally move to pooled stack visuals.