TurretController Inspector
Inspector Option Breakdown
This page explains each setting available in the TurretController and TurretSoundManager components.
🎯 TurretController
🛠️ Turret Settings
Turret Head
GameObject to rotate toward targets. If empty, uses the root object.
Rotation Speed
Rotation speed in degrees per second.
Head Rotation Offset
Useful if your turret model is misaligned. Applies additional rotation.
Lock Pitch Rotation
Prevents up/down aiming. Only rotates horizontally.
Turret Damage
Damage applied when a projectile or raycast hits an enemy.
Turret Fire Rate
How many shots per second the turret fires.
👁️ Detection Settings
Turret Range Radius
Detection range. Also sets SphereCollider radius.
Enemy Tag
Which tag to search for as valid targets. Default: Enemy
.
🔺 Cone Detection (optional)
Use Cone Detection
Restricts detection to a cone-shaped field of view.
Cone Angle
Width of the cone in degrees.
Cone Offset
Rotates the cone angle if needed.
Cone Mode
Fixed
(uses root rotation) or HeadAttached
(follows head direction).
🔫 Firing Settings
Projectile Prefab
Prefab to spawn when shooting. Leave empty for raycast mode.
Projectile Spawn Positions
List of spawn points (usually under the turret head).
Spawn Point Offset
Local position offset applied to each projectile.
Spawn Angle Offset
Local angle offset applied to each projectile.
Firing Mode
Sequential
(one by one) or Simultaneous
(all points).
Shoot Mode
Projectile
or Raycast
.
Max Angle Deviation
How aligned the turret must be before firing. Lower = more strict.
🔍 Obstacle Detection
Enable Obstacle Check
Prevents shooting if something blocks the shot.
Lock Rotation On Obstacle
Optionally stop turret rotation if path is blocked.
Obstacle Layer Mask
Layers to consider obstacles.
💡 Muzzle Effects
Raycast Trail Prefab
Optional trail effect for raycast mode.
Trail Lifetime
How long the trail effect stays.
Muzzle Decal Prefab
Optional VFX to spawn at muzzle.
Muzzle Decal Offset / Scale
Position/scale of decal effect.
Muzzle Light
Optional Light component for firing flashes.
Enable Light Flash
Toggles muzzle flash effect.
Light Intensity
Brightness of the flash.
🧠 Events (UnityEvents)
On Start
Fired when turret initializes.
On Shoot
Fired every time the turret shoots.
Enemy Is In Range
Fires when a valid enemy is found.
Is Rotating
Fires while turret is rotating.
On Raycast Hit
Fires if a raycast hits something (with RaycastHit data).
🔊 TurretSoundManager
Single Shot Sound
One sound clip to play per shot.
Random Shot Sounds
List of sounds to pick from randomly.
Use Random Sounds
Toggle to use random list instead of single clip.
Spatial Blend
0 = 2D, 1 = 3D sound.
Max Distance
How far the 3D sound reaches.
Rolloff Mode
Controls sound volume falloff (Logarithmic recommended).
💡 Tip: Use
PlayShotSound()
from your own code if you want to trigger sounds manually.
Last updated