Skip to content

✨ Sample Effects

Demo UseEffectObject assets you can assign to items.
Used by the Inventory and ItemUseSystem to trigger effects when an item is used.

🧩 These are examples only — safe to delete or replace.
💡 Great starting point for building your own custom use effects.


Purpose

Provide minimal, working examples of authorable item-use effects to demonstrate how UseEffectObject integrates with the Inventory system.


Contents

File Description
DebugPingEffect Logs a message when the item is used.
SpawnVfxEffect Spawns a prefab VFX at the target for a limited time.

🚀 Usage

  1. Create or open an ItemDefinition asset.
  2. Set usable = true.
  3. Add one or more effects to the useEffects[] array.
itemDef.usable = true;
itemDef.useEffects = new ScriptableObject[] { debugPingEffect, spawnVfxEffect };

When used (via ItemUseSystem or InventoryDebugPanel), these effects will automatically trigger.


⚙️ Extend It

You can subclass UseEffectObject to create your own effects:

public class HealEffect : UseEffectObject
{
    public int healAmount = 25;

    public override void Apply(IDamageable dmg, GameObject target)
    {
        if (dmg != null)
            dmg.Heal(healAmount);
    }
}

  • Use → main item use system
  • DataItemDefinition.useEffects[] field
  • Samples → sample asset overview