docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Creating a Pickup

    This tutorial explains how to create a Pickup item (like a Stamina recharge) that restores a player's stats when they interact with it. You will use the ModularInteractable system to detect players and apply effects.

    Prerequisites: Open the Core scene.

    Steps

    1. Create the Object

      • Create a new visual object (e.g., a Cylinder) in your scene to represent the pickup.
      • Ensure it has a Collider.
      • Add a NetworkObject component to it. This is required for networked interactions.
    2. Add Movement (Optional)

      • Add the AutomatedNetworkTransform component to make the pickup rotate or float.
      • Movement Type: Check Rotate Over Time.
      • Rotation Speed: Set Y to 90 (or your preferred speed).
    3. Add Network Object

      • Add the NetworkObject component to it. This is required for networked interactions.
    4. Add the Modular Interactable Component

      • Add the ModularInteractable component to your object.
      • Trigger Mode: Set this to On Focus Enter. This triggers the effect when the player gets close to the object.
      • Enable the Despawn After Interaction option to remove the object after it is picked up.
      • Change the despawn delay to 0 to remove it immediately.
      • See image for reference.
    5. Add Interaction Effects In the Modular Effects section of the inspector, click the dropdown to add the following effects:

      • Modify Stat Effect:
        • Stat Name To Modify: Stamina
        • Modification Amount: 25 (Positive restores stamina).

    6. Test in Multiplayer

      • Enter Play Mode.
      • Run around and jump to deplete your Stamina.
      • Go near the cylinder pickup. You should see your Stamina increase.

    Analyzing Examples

    1. Look for the DamageArea object in the scene.
    2. It uses the same logic but with Modification Amount set to -100 on Health, which eliminates the player.
    In This Article
    Back to top
    Copyright © 2026 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)