LSCS: Non Essential Components
The Large Scale Combat System comes with several optional but powerful supporting systems designed to enhance performance and immersion. This section covers the setup and configuration of the Animator LOD, Dynamic Audio, and Formation Flag systems.
1.AnimatorLOD
To maintain high performance in battles with hundreds or thousands of units, it is essential to reduce the work the CPU has to do. The Animator LOD (Level of Detail) system automatically reduces the update frequency of animations for units that are far from the camera or outside the screen, using the high-performance C# Job System.
- AnimatorLODSettings: A component that holds the global configuration for all LOD levels.
- AnimatorLODManager: The scene-based manager that runs the calculations.
- AnmatorLOD: A simple „tag“ component you add to your unit prefabs.
AnimatorLODSettings
This is the main configuration component. It should be placed on the same GameObject as the AnimatorLODManager.
- mainCamera: The primary camera used for distance calculations. If left empty, it will default to Camera.main.
- lodSettings: An array defining your LOD levels.
- distance: The distance at which this LOD level becomes active.
- updateEveryXFrames: How often the animator should update.
1means every frame,2means every second frame, etc.
- cullDistance: The absolute distance at which animators are effectively disabled.
- disableSkinnedMeshRenderer: If checked, the unit’s mesh will be hidden entirely when it is off-screen or beyond the cullDistance. This provides a significant performance boost.
- useLOD: A master switch to enable or disable the entire system.
Step 2: Addjust the AnimatorLOD settings on the Manager object in the Scene Prefab.
Step 3: Tag your Prefabs On your unit prefabs, add the AnimatorLOD component to the same GameObject that contains the Animator. It requires no further setup. The manager will automatically find and manage all active units with this component.

| Please note that hundreds of Animators are very heavy for the performance, even with AnimatorLOD. It is recommended to implement other animation solution such as GPU instancing, using the AnimatorLinkLODmanager |
2. AnimatorLinkLODmanager
The AnimatorLinkLODManager is a standalone system designed for intelligent animation management based on camera distance. It’s ideal for switching between different animation systems – for example, using a standard Unity Animator for close-up units and a performance-optimized GPU animation system for units further away.
Important: The AnimatorLinkLODManager operates independently of the AnimatorLOD (the job-based Animator LOD System). Its sole purpose is to explicitly control the AnimatorLink component attached to your units.
How it Works:
The manager monitors the distance of units from the camera. When a unit crosses the defined Cull Distance threshold (either moving in or out of range), the AnimatorLinkLODManager calls specific functions on the unit’s AnimatorLink component:
EnableAnimator(): Called when the unit is within the Cull Distance (e.g., to activate the standard Unity Animator).
DisableAnimator(): Called when the unit is outside the Cull Distance (e.g., to switch to a GPU animation system).

Configuring Weapon and Shield Switching (for GPU Animation):
The AnimatorLink component is designed to dynamically re-parent weapons and shields during these function calls. This feature is particularly useful when your GPU animation system requires its own specific Transforms for attached items (weapons, shields, etc.).
To utilize this functionality, you must correctly configure the Unit.cs component on your units:
New GPU Parent (e.g., New Hand Transform): This is theTransformwhere weapons and shields will be re-parented when the unit is rendered by a GPU animation system (e.g., a „virtual“ handTransformprovided by your GPU system).Old Parent (e.g., Standard Hand Transform): This is the originalTransformwhere weapons and shields are attached when the standard Unity Animator is active.Weapon (and/or Shield) GameObject: TheGameObjectof the weapon (or shield) that needs its parent switched.
Ensure that your chosen GPU animation system provides the necessary Transforms to which the weapons and shields can be re-parented.

Settings:
CullDistance: Defines the maximum distance from the camera within which the standard Unity Animator is used. If a unit exceeds this distance,DisableAnimator()is called.
3. Dynamik Audio System
This is an efficient, pooled audio system designed for large-scale battles. It prevents audio spam and performance issues by recycling a limited number of AudioSource components and managing sound cooldowns.
Components Overview
- AudioDefinitionSO.cs: A Scriptable Object that acts as a blueprint for a sound effect (e.g., „Sword Swing“).
- AudioManager.cs: The central singleton manager that plays all sounds.
- UnitAudio.cs: A component on your unit prefab that holds references to the AudioDefinitionSOs for that unit.
Setup and Configuration
Step 1: Create AudioDefinitionSO Assets For each type of sound in your game, create an AudioDefinitionSO.
- In the Project window, right-click: Create -> TopsonGames -> Unit Audio -> AudioDefinitionSO.
- Name it (e.g., Footstep_Dirt_SO).
- Configure its properties in the Inspector:
- clips: An array of AudioClips. The system will play a random clip from this array each time.
- maxConcurrentPlays: How many instances of this sound can play at the same time across the entire game? Prevents a „machine gun“ effect.
- cooldown: Minimum time in seconds before this sound definition can be triggered again.
- volume, pitch, random…Variance: These fields allow you to add natural variation to each sound played.
Step 2: Locate the AudioManager on the Scene Prefab under Manager.
- initialPoolSize: The number of
AudioSourcecomponents to create at the start. The pool will grow automatically if needed.
Step 3: Configure UnitAudio on your Prefabs Add the UnitAudio.cs component to your unit prefabs. Drag your created AudioDefinitionSO assets into the appropriate fields (footstepSound, attackSwingSound, etc.). The RelayAnimationEvents script will automatically call the correct methods on this component.
Step 4: Add AnimationEvents
In order for the RlayAnimationEvents script to revieve the call you need to add Animation events to the Animations you wish to call the Audio. The following Events can be placed:
- OnWalk
- OnSwing
- OnDeath
- OnCheer
Formation Flag System
This is a high-performance system that displays a 3D flag at the center of each formation, which always rotates on its Y-axis to face the camera (a „billboard“ effect).

Components Overview
- FlagManager.cs: The central manager that finds all flags and runs the job to update their rotations.
- FlagController.cs: A simple component placed on your flag prefab.
Setup and Configuration
- Create a Flag Prefab:
- Create a 3D model for your flag (e.g., a simple pole and plane).
- Add the FlagController.cs component to the root of this prefab.
- Locate the FlagManager: Locate the Flagmanager on the Scene Prefab under Manager.
- Link the Flag to your Formation Prefabs:
- Select one of your Formation prefabs (e.g., „RomanLegionary_Formation“).
- Find the Formation Collider
- Place the Flag Prefab as child of the Formation Collider as the collider presents the formations center and rotates with it
At the start of the game, each formation will now automatically instantiate its assigned flag. The FlagController on the flag will register itself with the FlagManager, which will then take over and update its position and rotation every frame.
Camera Controller
The LSCS includes a flexible, professional-grade RTS-style camera. It’s designed to give the player smooth and intuitive control over the battlefield, with built-in features for panning, rotating, zooming, and staying within the map boundaries.
CameraController.cs: The all-in-one script that provides the complete camera logic. It should be placed on your main camera.
CameraController Component
This is the main configuration component for all camera behavior. Add it to your Main Camera GameObject.
Input Actions via Reference This section links the camera’s functions to your Unity Input System Asset.
moveActionReference: The 2D Vector action for panning the camera (e.g., WASD).zoomActionReference: The 1D Axis action for zooming in and out (e.g., Mouse Scroll Wheel).sprintActionReference: The Button action to increase pan speed (e.g., Left Shift).rotateActionReference: The Button action that must be held to enable rotation (e.g., Middle Mouse Button).
Movement Settings
panSpeed: The base speed for camera movement.sprintMultiplier: How much faster the camera moves when the sprint key is held (e.g., a value of2means 200% speed).zoomSpeed: How quickly the camera zooms in and out.rotationSpeed: The speed of horizontal (left/right) rotation.pitchRotationSpeed: The speed of vertical (up/down) rotation.minZoomHeight/maxZoomHeight: The closest and furthest the camera can zoom, measured in world units (Y-axis).
Pitch Rotation Settings
minPitch/maxPitch: The minimum and maximum vertical angle (in degrees) the camera can tilt to.10is almost top-down,80is a low, cinematic angle.
Smoothing Settings These values control the smoothness and inertia of the camera, preventing abrupt starts and stops. A lower value means a faster, more responsive camera, while a higher value results in a smoother, more cinematic feel.
panSmoothTime: Smoothing for WASD movement.zoomSmoothTime: Smoothing for the scroll wheel zoom.rotationSmoothTime: Smoothing for the camera rotation.
Ground Clipping Prevention This system prevents the camera from clipping into the terrain when zooming or moving over hills.
groundLayer: The physics layer your terrain or ground plane is on. The camera will use a raycast on this layer to detect the ground height.minHeightAboveGround: The minimum distance the camera will always keep from the ground.
Screen Edge Controls
This allows you to move / rotate the camera by dragging the mouse to the screens edge and further
- Screen Edge Border Thickness: Thickness until the end of the screen where the dragging should take place
- Panning Mode: Which Borders should be affected
- Enable Screen Edge Rotation: Should the camera rotate when the mouse is on the left or right screen border
Cursor
lockCursor: If checked, confines the mouse cursor to the game window, which is common for RTS games.
World Boundaries This feature locks the camera within a defined playable area.
lockCamera: A master switch to enable or disable the boundary lock.worldCorner1/worldCorner2: Assign two emptyTransformobjects placed at the diagonal corners of your map. The script will draw a Gizmo in the Scene View to help you visualize this boundary.