272 words
1 minute

How to Get Rid of Sticky Walls in Unity

By · Game Designer · Digital Artist
Unity 2D Inspector with a zero-friction Physics Material 2D applied to the player Rigidbody 2D

Solution Overview#

A common issue in 2D Unity game development: characters unintentionally adhere to wall surfaces during gameplay. Here’s the quick fix — a Physics Material 2D with zero friction, dragged onto the player Rigidbody 2D.

Hitting this before you’ve even given your sprite collision geometry? Start with Adding a 2D Collider to Sprites in Unity, then come back.

Animated demo of the sticky-wall bug in Unity 2D: the player character clings to a vertical wall instead of falling under gravity

Step-by-Step Instructions#

Step 1: Create Physics Material 2D#

Right-click on the Assets section (or in any folder) and navigate to Create → 2D → Physics Material 2D.

Unity Project window context menu opened on the Assets folder with the Create → 2D → Physics Material 2D path highlighted

Step 2: Configure Friction Settings#

Name your new material — the example uses slide. In the right panel, find the Friction value and set it to 0.

Unity Inspector showing a Physics Material 2D named slide with the Friction field edited to 0

Detail view of the Physics Material 2D Inspector with Friction set to 0 and Bounciness left at default

Step 3: Apply Material to Player#

Select your player character and find its Rigidbody 2D component. Locate the Material field and drag your newly created Physics Material 2D into it.

Unity Inspector with the player Rigidbody 2D Material slot ready to receive the dragged Physics Material 2D

Unity Inspector after dropping the slide Physics Material 2D into the player Rigidbody 2D Material field

Step 4: Test#

And it’s done. Your character should no longer stick to walls when you run the game.

Animated demo of the fixed behavior: the player character now slides down walls under gravity instead of sticking

Related Posts

Same category
  1. 1
    Maya Basics — a Five-Minute Tour
    Cookbook · A short tour of the Autodesk Maya interface — workspace, viewport navigation, primitive shapes, modeling tools, and the channel box. For first-timers.
  2. 2
    How to Color in Corel Painter
    Cookbook · The Corel Painter colour picker in one tour — open the palette, the detailed mixer, the eyedropper, and how to build a custom palette from scratch.
  3. 3
    How to Add a 2D Collider to Sprites in Unity
    Cookbook · How to add and adjust a 2D collider on a sprite in Unity so it can actually collide with the world. The Inspector flow, in five clicks.
  4. 4
    How to Add an Icon for a Game in Unity
    Cookbook · The shortest path to setting a game icon in Unity — File → Build Settings → Player Settings — plus fixes for the two mini-problems you'll run into.

Random Posts

Random
  1. 1
    How to Color in Corel Painter
    Cookbook · The Corel Painter colour picker in one tour — open the palette, the detailed mixer, the eyedropper, and how to build a custom palette from scratch.
  2. 2
    How to Use Brushes in Photoshop
    Cookbook · Where to find the Brush Panel, why Brush Settings matter, and how to load custom ABR brush sets — the three Photoshop brush moves every painter sets up first.
  3. 3
    Maya Basics — a Five-Minute Tour
    Cookbook · A short tour of the Autodesk Maya interface — workspace, viewport navigation, primitive shapes, modeling tools, and the channel box. For first-timers.
  4. 4
    How to Add an Icon for a Game in Unity
    Cookbook · The shortest path to setting a game icon in Unity — File → Build Settings → Player Settings — plus fixes for the two mini-problems you'll run into.
How to Get Rid of Sticky Walls in Unity
https://heyleiloo.com/how-to-get-rid-of-sticky-walls-in-unity/
Author
Leila Mikhaleva
Published
2025-03-10
License
CC BY-NC-ND 4.0