Easy Chapter Generator
EnglishEspañol

Complete when required objects are destroyed

DestructionObjective watches an explicit array of GameObject references. During Update it waits until every configured Unity object compares as null, then requests completion once through the base Objective contract. It is suitable for destructible targets that are genuinely removed with Object.Destroy.

Do not use it for pooled targets that are merely disabled, hidden, moved, or returned to an object pool; those references remain non-null. Let the pool or combat system emit a completion signal, or create a custom Objective that understands its alive-state contract.

Fields and minimum configuration

FieldRequirementRuntime meaning
Objective LinkLink to the intended active rowDetermines which exact completion request can succeed
Objects To DestroyAt least one non-null targetAll entries must become Unity-null
On CompletedOptionalRuns only after the Chapter accepts completion

An empty or null array never completes. A null entry inside a nonempty array is already considered destroyed, so assign every target deliberately before the run. Children are not implied: add each independent object that must be destroyed or track a common root that your gameplay actually destroys.

Runtime polling and reset boundary

The component performs a short linear scan each frame until it completes. Once the base IsCompleted flag is true, polling stops. The inherited Reset clears that flag, but it cannot recreate destroyed GameObjects or restore their health, materials, colliders, or particle systems. Your project must respawn or reset targets before reusing the Objective.

For a small fixed target set this polling cost is negligible. For hundreds of pooled enemies, prefer an event-driven project counter and call the Chapter when the authoritative count reaches zero.

Example: destroy three marked crates

  1. 1
    Create one Objective container and add DestructionObjective.
  2. 2
    Set Objects To Destroy size to 3 and assign the three crate roots destroyed by gameplay.
  3. 3
    Link the component to the current Ordered Objective. Use start actions to reveal the crates and completion actions to hide the marker.
  4. 4
    In Play Mode, destroy each crate. Completion must occur only after the final reference becomes null.

The target disappeared but the row stays Active

Confirm the object was destroyed, not disabled or pooled, and that the array stores the destroyed root rather than an unaffected parent.

The row completes too early

Inspect for unassigned or already destroyed array entries before activation.

Restart shows no targets

Reset progression does not reconstruct scene content. Add project-owned respawn logic to the Chapter or Objective start edge.