Target Spawning & Objective Modes

A reusable Unity target system for drill-specific target groups, target slots, respawning objectives, destroy-all missions, target health, damage routing, and mission completion notifications.

System Overview

This system handles the targets themselves: where they appear, how they reset, how they break, and how they tell the mission that progress happened.

What It Does

The Target Spawning & Objective Modes system gives each target range mission a reusable way to activate the correct target group, choose active target slots, handle target destruction, and report objective progress back to the mission controller.

Each target group can support different drill behavior. Some missions use active target limits and respawn delays, creating an arcade-style target loop. Other missions use destroy-all behavior, where targets stay broken and the objective is to clear the entire group.

This keeps target behavior modular. The mission framework does not need to micromanage every target. It only needs to know which group is active and when a target has been destroyed.

Primary Role

Manage target groups, activation, respawning, destroyed state, damage response, and mission objective notifications.

Core Loop

Activate group → Spawn active targets → Damage target → Destroy target → Notify mission → Respawn or preserve state.

Portfolio Value

Demonstrates modular objective design, runtime object management, damage interfaces, and reusable gameplay rules.

Target System Snapshots

Screenshot references for target group setup, target slots, active gameplay targets, destroyed-state behavior, health values, and projectile hit routing.

Unity Inspector screenshot of TargetRangeTargetGroup showing group ID, target slots, respawn settings, active target count, and objective mode values

Target Group Inspector

Target groups define which targets belong to a drill and how that drill should activate, respawn, or preserve them.

  • Target Group
  • Group ID
  • Respawn Rules
Unity Inspector screenshot showing target slot references assigned to a target range group

Target Slot Setup

Slots let the range treat individual target objects as part of a larger drill-specific pool.

  • Target Slots
  • Pool Setup
  • Inspector Workflow
Gameplay screenshot showing active targets spawned in the target range environment during a running mission

Active Target Runtime

During a mission, only the correct group and target count are active, keeping each drill focused.

  • Runtime Targets
  • Mission Active
  • Drill Focus
Gameplay screenshot showing destroyed or broken targets after being hit during a target range drill

Destroyed Target State

Destroy-all objectives can preserve broken target visuals instead of immediately resetting them.

  • Destroyed State
  • Visual Feedback
  • Objective Progress
Unity Inspector screenshot of TargetHealth showing health values, destroy effects, XP reward settings, and target damage configuration

Target Health

TargetHealth receives damage, tracks remaining health, handles effects, and reports destruction.

  • IDamageable
  • Health
  • Damage Response
Gameplay screenshot showing a projectile hit or impact moment on a target during the target range mission

Projectile Hit Routing

Projectiles route damage through IDamageable, allowing the target system to work with reusable weapon fire logic.

  • Projectile
  • DamageInfo
  • Hit Detection

Target Flow

The target group acts like a tiny stage manager, pushing targets on and off the range as the drill demands.

1. Mission Selects Group

The active mission references a target group ID, and the mission controller activates the matching group.

2. Group Resets Targets

The target group prepares its slots, hides inactive targets, and resets health or destroyed state as needed.

3. Active Targets Spawn

Based on the mission rules, the group chooses how many targets should be active at once.

4. Projectile Deals Damage

Projectile hit detection finds an IDamageable target and sends DamageInfo into TargetHealth.

5. Target Is Destroyed

TargetHealth handles health depletion, effects, XP rewards, and destroyed notifications.

6. Group Updates Objective

The target group reports the destroyed target to the mission controller, then respawns or preserves the target depending on mode.

Objective Modes

Different target behaviors make the same range support different types of weapon drills.

Respawn Loops vs Destroy-All Targets

Some target range drills work best when targets keep coming back. This creates a sustained scoring loop where the player focuses on speed, accuracy, and weapon control over a time limit.

Other drills work better as a fixed-clear objective. In those cases, each target should stay destroyed, preserving the visual evidence of progress and making the room feel physically changed by the player’s actions.

Supporting both modes inside the same target group system makes the range more reusable. The same framework can run quick reflex drills, precision clearing drills, shotgun spread tests, or future target puzzles without needing a new target controller for each mission.

Respawning Targets

  • Useful for timed score drills
  • Keeps the range active
  • Supports max active target counts
  • Uses respawn delay timing

Destroy-All Targets

  • Useful for clear-the-room drills
  • Preserves destroyed progress
  • Makes completion visually readable
  • Avoids unwanted respawn clutter

Shared Benefits

  • Same mission pipeline
  • Same damage routing
  • Same HUD objective updates
  • Different drill personalities

Key Components

Each target-side script has a focused responsibility, keeping the whole range from becoming a cardboard hydra.

TargetRangeTargetGroup

Owns a group of target slots, group ID matching, active target selection, target activation, respawn timing, and objective-mode behavior.

  • Target Pool
  • Activation
  • Respawning

TargetRangeMissionTarget

Bridges each individual target to its group. It handles activation, hiding, reset calls, destroyed state preservation, and notification flow.

  • Target Slot
  • Group Bridge
  • Destroyed State

TargetHealth

Implements damage handling for targets. It receives DamageInfo, subtracts health, awards XP, spawns effects, and triggers destroyed callbacks.

  • Health
  • Damage
  • Destruction

IDamageable

Provides a simple interface that lets projectiles damage targets without knowing the exact target class.

  • Interface
  • Reusable Damage
  • Loose Coupling

DamageInfo

Carries damage amount, weapon ID, weapon type, source object, and hit point so damage events have useful context.

  • Damage Payload
  • Weapon Context
  • Hit Point

Projectile

Performs hit detection, ignores the weapon owner, detects IDamageable targets, registers hits with the mission, and sends DamageInfo forward.

  • Hit Detection
  • Projectile Logic
  • Mission Hits

Damage Routing

Damage travels through a small, reusable path instead of being hardwired to one specific target script.

Projectile Moves

The projectile travels using its configured speed, lifetime, collision settings, and optional sweep detection.

Collision Is Checked

The projectile checks hit colliders, ignores the owning player object, and filters out other projectiles.

IDamageable Is Found

The projectile searches for IDamageable on the hit object or its parent/children.

Mission Hit Is Registered

If the mission controller exists, the hit is counted for accuracy and scoring feedback.

DamageInfo Is Sent

The projectile packages weapon ID, weapon type, source object, hit point, and damage amount.

Target Responds

TargetHealth applies the damage, handles destruction, awards XP, and notifies the mission target layer.

Inspector Workflow

Most tuning happens in Unity Inspector fields, which makes this page better served by images than full code dumps.

Why No Full Script Dropdown Here?

This system is heavily driven by visible Unity setup: target group IDs, slot arrays, active target counts, respawn timing, target health values, effects, layers, and references. The Inspector tells the story better than a large script block would.

The code still matters, but the portfolio value here is showing that the system is designer-friendly. A new target drill can be assembled by assigning targets to a group and tuning values, rather than rewriting target logic.

That makes this a good example of practical Unity workflow: code creates the framework, while the Inspector becomes the control panel.

Good Inspector Shots

  • TargetRangeTargetGroup component
  • Target slot list expanded
  • TargetHealth values
  • Layer mask setup
  • Destroyed target gameplay

Good Gameplay Shots

  • Targets inactive before mission
  • Targets active during mission
  • Projectile impact moment
  • Broken targets after destruction
  • HUD progress after target hit

Good Story Angle

Reusable range architecture where target behavior is configurable through scene setup and mission data.

Problems Solved

This system came from the moment the range needed more than “shoot one object until it disappears.”

Key Iteration Wins

The first target range version only needed simple target destruction. As weapon drills expanded, the system needed groups, respawns, active target limits, mission-specific objectives, and better destroyed-state handling.

Respawning targets created good repeatable drills, but destroy-all objectives needed different behavior. Broken targets should not always reset instantly, especially when completion depends on clearing a room.

Separating target groups from individual target health created a cleaner architecture. The health script worries about damage. The mission target script worries about target state. The target group worries about the active pool. The mission controller worries about the objective.

Before

Targets were simple damageable objects without flexible group behavior or objective modes.

After

Target groups can activate specific drill areas, respawn targets, preserve destroyed state, and report objective progress.

Result

The range supports multiple drill styles without creating a new target system for every mission.

Portfolio Value

This page shows the object-management side of the target range framework.

What This Demonstrates

Target Spawning & Objective Modes demonstrates Unity gameplay architecture built around reusable runtime objects, configurable Inspector workflows, and clear event routing between targets, projectiles, mission state, and HUD feedback.

It shows that the target range is not a hardcoded room. It is a flexible framework where each mission can activate different target groups and objective behavior through data and scene references.

For portfolio purposes, this is a useful slice because it shows practical Unity problem solving: scene setup, runtime activation, interfaces, damage payloads, target pooling behavior, and objective updates all working together.

Demonstrates

  • Runtime object activation
  • Objective mode design
  • Damage interface usage
  • Inspector-driven workflow

Good For

  • Gameplay programmer roles
  • Unity systems roles
  • Technical design discussion
  • Portfolio walkthroughs

Next Improvements

  • Weighted target selection
  • Moving target support
  • Weak point targets
  • Target pattern presets

Related Systems

Target spawning connects directly to mission state, projectile hit detection, weapon data, and saved progression.

Target Range Mission Framework

Covers drill state, mission selection, HUD feedback, scoring, accuracy, trial completion, and return-to-hub flow.

Projectile & Hit Detection

Covers projectile movement, sweep detection, collision routing, dropped projectile behavior, and damage payloads.

Save, Progression & Unlocks

Covers completed mission IDs, weapon unlocks, active weapon data, weapon type XP, and save persistence.