docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Double Jump

    This tutorial explains how to add a Double Jump capability to your player character. The system is split into two parts:

    • Movement Ability: Handles the physical calculation of the jump.
    • Player Addon: Handles the input logic and conditions (e.g., checking if the player is already jumping).

    Prerequisites: Open the your Player object (e.g., [BB] CorePlayer).

    Steps

    1. Add the Double Jump Ability

    The Ability component handles the physics of the movement.

    1. Inspect your Player object.

    2. Find the Core Movement (Script) component.

    3. Locate the Movement Abilities section.

    4. In the dropdown, select DoubleJumpAbility.

    5. Click Add.

    2. Add the Double Jump Addon

    The Addon component handles the input and state management.

    1. On the same Player object, find the Core Player Manager (Script) component.

    2. Locate the Player Addons section.

    3. In the dropdown, select DoubleJumpAddon.

    4. Click Add.

    3. Configure the Addon

    Now configure the addon to respond to player input.

    1. Locate the newly added Double Jump Addon (Script) component on your player.

    2. Settings:

      • Double Jump Height: Set this to your desired height (e.g., 2).
      • Stamina Cost: (Optional) Set a cost if you want to consume stamina.
    3. Input Events:

      • On Jump Pressed: Assign the OnJumpPerformed Game Event (found in Assets/Core/GameEvents/Input/). This connects the input action to the double jump logic.

    4. Test

    1. Enter Play Mode.
    2. Jump once, then press jump again while in the air.
    3. Your character should perform a second jump.

    Understanding the System

    • CoreMovement: The central motor that executes movement. We extended it by adding the DoubleJumpAbility.
    • CorePlayerManager: Manages player state. We added the DoubleJumpAddon to listen for inputs and tell CoreMovement when to execute the ability.
    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)