Skip to content

RevFramework – Pickups • Utilities

Folder: Runtime/Systems/Pickups/Utilities

The Utilities folder contains small helper components used by the Pickups system.
These are lightweight, self-contained behaviours that support effects and decorators.

✔ Simple runtime helpers
✔ Not full systems or gameplay logic
✔ Safe to include in all builds


🎯 Purpose

Utilities exist to:

  • Provide tiny, reusable helper behaviours
  • Support effects and decorators without bloating core systems
  • Keep one-off or mechanical logic out of Core/ and Runtime/

Everything in this folder is intentionally small, local, and optional.


📦 Included Utilities

DestroyWithTarget

Destroys its own GameObject when the assigned target becomes null.

Primarily used by decorators such as PersistentVFXDecorator to automatically clean up spawned VFX when the owning actor or source object is destroyed.

public class DestroyWithTarget : MonoBehaviour
{
    public GameObject target;

    void Update()
    {
        if (target == null)
            Destroy(gameObject);
    }
}

Behaviour

  • Evaluated once per frame
  • When the referenced target no longer exists, the helper object self-destructs
  • Prevents spawned visuals or helpers from lingering after their owner is gone

This component has no external dependencies and performs no gameplay logic.


🔁 Usage

Typical usage:

  • Add DestroyWithTarget to temporary or spawned GameObjects (e.g. persistent VFX)
  • Assign target to the actor, pickup, or source object the helper should track
  • When the target is destroyed or despawned, the helper object is cleaned up automatically

This pattern avoids manual lifetime bookkeeping in effects or decorators.


➕ Extending Utilities

Use this folder for tiny helpers only.

Good Candidates

  • Cleanup helpers
  • Simple follow / rotate / pulse behaviours
  • One-off lifetime or transform utilities
  • Low-complexity logic with no shared state

Not Suitable Here

  • Components that manage shared state
  • Gameplay rules or progression logic
  • Systems that coordinate multiple actors

Those belong under Systems/ or a dedicated module.


📘 See Also

  • Decorators — many decorators spawn objects that use these helpers
  • Runtime — scene-facing pickup components