How to set up a ledge grab system for platformer in Unity

Let’s go over how to add a ledge grab system to the platformer project.

I am continuing to add to the Player script from this article. Animations in the article are from

First, add a collider to the player which will be used to detect ledges. Set the collider to IsTrigger and the tag to “Ledge”:

On the platform, add a similar collider together with a RidgidBody:

Add two more boxes to the platform. One for where the player will have the feet while holding on to the ledge and another for where the player will stand after climbing up:

Create a script called LedgeGrabber and attach it to the collider on the platform:

Open the Player script. Add a bool to check if the player is currently grabbing the ledge. Also add a Vector3 for the position of the player after climbing up:

In the PlayerMovement function check if the E key is pressed while the player is grabbing the ledge and if so, trigger the climb animation:

Create two public functions, one for handling the ledge grab and another for handling the climbing:

Open up the LedgeGrabber script. Add two serialized Transforms for the positions. Add an OnTriggerEnter function, and if the ‘Ledge’ object on the player is detected set the player’s position:

Open up the Animator window and set up the animations as shown in the screenshot below:

Select the Climbing animation state and add a behaviour:

Open up the behaviour script. In the Exit event call the SetClimbUpPosition on the player:

Lastly, drag the transforms on the platform onto the LedgeGrabber script on the inspector:

Good luck!




Unity / C# Game developer

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

What is an algorithm and why should you care?

Deploy your Components with Terraform and Gitlab CI in Air-Gapped-Environments (Terraform CE)

Roblox Ultimate Driving Codes November

Roblox Ultimate Driving Codes November

Bilibili! Anime super-resolution model

Managing Multiple Dev Environments

Microservices Design Patterns

AWS SQS (Simple Queue Service)


Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Niklas Bergstrand

Niklas Bergstrand

Unity / C# Game developer

More from Medium

‘’The only impossible journey is the one that you never began”-Tony Robbins

What Happens Under the Facade of Neoliberalism

Weekend Links — Jan 8 2022

Wk 1, 1.26 — Reading Response