RevFramework – Pickups • Definitions¶
Folder: Runtime/Systems/Pickups/Definitions
The Definitions folder contains the ScriptableObjects that describe pickups.
These assets are authored in the Editor and act as the data input to the runtime pickup-effect pipeline.
✔ Designer-friendly authoring assets
✔ Clean separation between data and logic
✔ Built-in decorator support
✔ Fully compatible withPickupEffectFactory
🎯 Purpose¶
Definitions exist to:
- Provide authoring assets for all pickup types
- Separate configuration data from runtime logic
- Allow decorators to be attached and ordered deterministically
- Feed
PickupEffectFactorywith everything required to build a final effect chain
Definitions are pure data. They never execute gameplay logic.
🧩 Key Base Class¶
PickupEffectDefinitionBase¶
Abstract base class for all pickup definition assets.
Responsibilities¶
- Store designer-facing configuration
- Declare which decorators should wrap the effect
- Expose built-in decorator fields (audio, VFX, conditions, etc.)
- Provide the data needed to construct a runtime
PickupEffect
Common Fields¶
General¶
pickupName— friendly display/debug namepickupSprite— optional icon for UI/toolingdestroyOnUse— destroy pickup instance after successful usespawnInScene— editor workflow convenience flagsavePath— editor prefab/asset creation path
Decorators¶
List<DecoratorDefinition>— ordered decorator declarations
Built-in Decorator Fields¶
These fields are consumed by the built-in decorator creators:
- Sound — audio clip + volume
- One-shot VFX — prefab, offset, lifetime, spawn-on-target
- Persistent VFX — prefab, offset, duration, parenting, destroy-with-target
- Conditions — health %, tag checks, random chance
Required Override¶
Every definition must implement:
public abstract PickupEffect CreateCoreEffect();
The factory calls this method to produce the core PickupEffect, then wraps it with decorators in priority order.
📦 Included Definitions¶
| Definition | Purpose |
|---|---|
| InstantHealPickupDefinition | Heals instantly (optional delay). |
| RegenPickupDefinition | Heals over time (tick-based). |
| ShieldPickupDefinition | Applies a shield with duration and stacking rules. |
| TeleportPickupDefinition | Teleports the actor, optional velocity reset. |
| GiveItemPickupDefinition | Grants items via the Inventory bridge. |
| GiveCurrencyPickupDefinition | Grants currency via service, relay, or reflection. |
| VfxBurstPickupDefinition | Spawns a one-shot VFX burst. |
| AnimatorTriggerPickupDefinition | Fires an Animator trigger on the actor. |
Each definition maps directly to a concrete runtime PickupEffect implementation.
🧱 DecoratorDefinition¶
Represents a decorator entry inside a definition asset.
[Serializable]
public class DecoratorDefinition
{
public DecoratorType type;
public int priority;
}
Priority Rules (truth-aligned)¶
- Lower priority values → applied first → inner decorators
- Higher priority values → applied last → outer decorators
At runtime:
- The outermost decorator runs its
BeforeApplyfirst - The innermost decorator runs closest to the core effect
This ordering is deterministic and enforced by the factory.
🔁 How It Works¶
- Create a Pickup Definition via:
Assets → Create → RevFramework → Pickups → Definitions → … - Configure core settings and built-in decorator fields
- Add
DecoratorDefinitionentries and set priorities - At runtime,
PickupEffectFactory: - Calls
CreateCoreEffect() - Sorts decorators by ascending priority
- Wraps the effect chain in the correct order
The result is a single PickupEffect instance representing the fully-decorated behaviour.
➕ Extending the System¶
To add a custom pickup definition:
- Subclass
PickupEffectDefinitionBase - Implement
CreateCoreEffect()to construct your effect - Add any additional serialized fields required for configuration
Example¶
[CreateAssetMenu(menuName = "RevFramework/Pickups/Definitions/Custom Effect")]
public class MyCustomPickupDefinition : PickupEffectDefinitionBase
{
public float power = 5f;
public override PickupEffect CreateCoreEffect()
{
var fx = ScriptableObject.CreateInstance<MyCustomEffect>();
fx.power = power;
return fx;
}
}
Your custom definition automatically integrates with the decorator factory pipeline.
📘 See Also¶
- Core — effect pipeline and factory
- Decorators — how effects are wrapped and extended
- Effects — built-in effect catalogue