Fixed-Angle Reload Configuration
中文 | English
Run this command at the repository root to replay the examples through the local Unity MCP. The command also captures screenshots in both languages.
python Docs/Manual/manual/tools/tutorials.py run fixed-angle-reload --capture
Click to expand MCP actionsClick to collapse MCP actions
Prepare the teaching sample. The recipe provides ${variables}.
{
"variables": {
"sharedGun": "${fixture}/Tutorial_FixedAngleReload_SharedGunData.asset",
"vehicle": "${fixture}/Tutorial_FixedAngleReload_VehicleTextData.asset"
},
"calls": [
{
"tool": "invoke",
"arguments": {
"path": "static:UnityEditor.AssetDatabase/CreateFolder",
"args": [
"${fixtureParent}",
"${folder}"
]
},
"expect": {
"regex": "\\(String\\) [a-f0-9]{32}"
}
},
{
"tool": "invoke",
"arguments": {
"path": "static:UnityEditor.AssetDatabase/CopyAsset",
"args": [
"Packages/com.shanghaiwindy.coreresources/BuiltInVehicles/PatriotRadar/BuiltIn-Patriot-Radar-SharedGun.asset",
"${sharedGun}"
]
},
"expect": {
"contains": "True"
}
},
{
"tool": "invoke",
"arguments": {
"path": "static:UnityEditor.AssetDatabase/CopyAsset",
"args": [
"Packages/com.shanghaiwindy.coreresources/BuiltInVehicles/PatriotRadar/BuiltIn-Patriot-Radar_VehicleTextData.asset",
"${vehicle}"
]
},
"expect": {
"contains": "True"
}
}
]
}
Fixed-angle reload uses the gun buff TankFireSpecificAngleReloadBuff. After firing or switching shell type, it can wait for a configured delay, constrain turret angles and scale rotation speeds. The constraint is removed after reloading finishes.
1. Prepare shared gun parameters
In the Project window choose Create > A Panzer War - 装甲纷争 > G Ground Vehicle - 地面载具 > Shared Data - 共享数据 > Gun - 炮管 to create SharedGunData. Expand tankFireParameter and find the Buffs reference list, buffRefs.
This recipe copies an existing gun configuration to preserve its initialization data. Editing shared gun data affects all referencing vehicles. For a change to one vehicle, create a separate shared-data copy, or clear that vehicle's sharedGunData before editing its own TFParameter.

Click to expand MCP actionsClick to collapse MCP actions
[
{
"tool": "inspect_set",
"arguments": {
"path": "static:UnityEditor.Selection/activeObject",
"value": "@asset:${sharedGun}"
},
"expect": {
"contains": "OK:"
}
},
{
"tool": "inspect",
"arguments": {
"path": "asset:${sharedGun}/tankFireParameter"
},
"expect": {
"contains": "TankFireParameter"
}
}
]
2. Add the fixed-angle reload buff
In the main gun's Tank Fire Params → Misc Settings → Buffs (buffRefs), click +. Open the entry's Value type menu and pick TankFireSpecificAngleReloadBuff. Expand it and enter the sample values:
| Field | Teaching value and meaning |
|---|---|
hasDelay / delay |
Enable the delay and set it to 0.5 seconds |
isTraverseLocked |
Enable Lock Traverse |
hasSpecificTraverseAngle / specificTraverseAngle |
Enable the specific traverse angle and set 0 degrees |
hasSpecificElevationAngle / specificElevationAngle |
Enable the specific elevation angle and set 5 degrees |
isOverrideTraverseSpeed / overrideTraverseSpeedCoff |
Override traverse speed with -0.5, a 50% reduction |
isOverrideElevationSpeed |
Leave disabled to preserve elevation speed |
Each switch controls its corresponding field. With traverse locked, the turret holds the configured angle or the angle at the start of the reload state. With traverse unlocked, the turret continues following the aim point. Elevation independently holds its configured angle or its angle on entry. Click Save on the reference entry, then save the gun asset.
The current list is AbstractTankFireBuffCasterSafeRef[]; the legacy buffs field is deprecated. The MCP recipe creates a real SafeRef entry by supplying both its type and configuration JSON.

Click to expand MCP actionsClick to collapse MCP actions
Whole-array JSON assignment creates real SafeRef entries with the type name and serialized configuration. The recipe verifies persisted data and leaves deprecated buffs untouched.
[
{
"tool": "inspect_set",
"arguments": {
"path": "asset:${sharedGun}/tankFireParameter/buffRefs",
"value": "[{\"fullName\":\"ShanghaiWindy.Core.TankFireSpecificAngleReloadBuff\",\"className\":\"ShanghaiWindy.Core.TankFireSpecificAngleReloadBuff, Core\",\"json\":\"{\\\"hasDelay\\\":true,\\\"delay\\\":0.5,\\\"isTraverseLocked\\\":true,\\\"hasSpecificTraverseAngle\\\":true,\\\"specificTraverseAngle\\\":0,\\\"hasSpecificElevationAngle\\\":true,\\\"specificElevationAngle\\\":5,\\\"isOverrideTraverseSpeed\\\":true,\\\"overrideTraverseSpeedCoff\\\":-0.5,\\\"isOverrideElevationSpeed\\\":false}\",\"safeRefAssetProvider\":{\"assets\":[]}}]"
},
"expect": {
"contains": "OK:"
}
},
{
"tool": "inspect",
"arguments": {
"path": "asset:${sharedGun}/tankFireParameter/buffRefs/0/fullName"
},
"expect": {
"contains": "TankFireSpecificAngleReloadBuff"
}
},
{
"tool": "inspect",
"arguments": {
"path": "asset:${sharedGun}/tankFireParameter/buffRefs/0/json"
},
"expect": {
"contains": "\"specificElevationAngle\":5"
}
}
]
3. Bind it to a vehicle
Assign the shared gun asset to VehicleTextData.sharedGunData. When set, GetTankFireParam() reads that asset's tankFireParameter. Without a shared reference, it reads the vehicle's TFParameter.
Save and read the buff configuration back to confirm the intended asset is used.
Click to expand MCP actionsClick to collapse MCP actions
[
{
"tool": "inspect_set",
"arguments": {
"path": "asset:${vehicle}/sharedGunData",
"value": "@asset:${sharedGun}"
},
"expect": {
"contains": "OK:"
}
},
{
"tool": "inspect",
"arguments": {
"path": "asset:${vehicle}/GetTankFireParam()/buffRefs/0/json"
},
"expect": {
"contains": "\"overrideTraverseSpeedCoff\":-0.5"
}
}
]
4. Check
Verify the type, delay, angles, speed coefficient and shared reference. Runtime code removes the constraint through a periodic check after reloading completes. This tutorial does not verify the in-game constraint or restoration behavior.
Click to expand MCP actionsClick to collapse MCP actions
These calls verify editor configuration, shared references and persistence. Fixed angles, speed scaling and restoration after reload still require an in-game check.
[
{
"tool": "invoke",
"arguments": {
"path": "static:UnityEditor.AssetDatabase/SaveAssets",
"args": []
},
"expect": {
"contains": "OK:"
}
},
{
"tool": "inspect",
"arguments": {
"path": "asset:${sharedGun}/tankFireParameter/buffRefs/0/json"
},
"expect": {
"contains": "\"delay\":0.5"
}
},
{
"tool": "inspect",
"arguments": {
"path": "asset:${vehicle}/sharedGunData/name"
},
"expect": {
"contains": "Tutorial_FixedAngleReload_SharedGunData"
}
}
]