# Player GameObject - Jump

### **Unity Configuration Steps:  Jumping Player**

In order to use the following script to enable your player to jump, the following changes must be configured in Unity before the following script will work

#### **Custom Layer:  Ground**

* Create a new **Layer:** **Ground** in the Unity Layer Editor.  All gameObjects which will act as ground, (example: Floor) to allow jumping, must have this layer set in the inspector. See image below

![](https://3353821304-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M0-KLgOacVpbicrqehO%2F-M04eWSVrF1dPNoG3KOs%2F-M04eY1m8BhGUg-fxdMW%2FScreen%20Shot%202019-02-12%20at%2011.15.18%20AM.png?generation=1581716767014153\&alt=media)

### Floor:&#x20;

Create an empty gameObject, rename to Floor\
Add BoxCollider2D  as shown in image below\
Select and icon for the gameObject - select in top section of inspector - example green oval\
Set **Layer: Ground**, after following directions to create custom layers below.

![](https://3353821304-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M0-KLgOacVpbicrqehO%2F-M0TPQNI4Fq138aslKm4%2F-M0TPXM7CX3H00iiJW9S%2FScreenshot%202020-02-19%2011.06.02.png?alt=media\&token=c2b4c56a-4021-423d-8bea-b0b01e33b726)

![Floor: Empty GameObject with BoxCollider ](https://3353821304-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M0-KLgOacVpbicrqehO%2F-M0TOX0eHXCAyfx_vPaz%2F-M0TPB86RqY9-IGC4tgF%2FScreenshot%202020-02-19%2011.04.16.png?alt=media\&token=9ae41116-66c6-4b18-a114-8c69c4b45a95)

&#x20;Set Layer: Ground

![](https://3353821304-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M0-KLgOacVpbicrqehO%2F-M04eWSVrF1dPNoG3KOs%2F-M04eY1oDKLUdXXEckDZ%2FScreen%20Shot%202019-02-12%20at%2011.18.11%20AM.png?generation=1581716766504249\&alt=media)

### **GroundCheck**

* **GroundCheck:** Create an empty gameObject, make it a child of the Player, name: **GroundCheck**. Add an icon (blue capsule in the image ), so it's easy to see.  Move the GroundCheck gameObject to the bottom of the player's feet, this gameObject will check to see if it's in contact with a gameObject that is in the 'Ground' layer. &#x20;

![](https://3353821304-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M0-KLgOacVpbicrqehO%2F-MGW5FrSxLxNzRkvaT4U%2F-MGW5ramA9ya6CvupJJS%2FScreen%20Shot%202020-09-05%20at%208.49.29%20PM.png?alt=media\&token=df5605fc-8e85-424d-aeb6-512816da2c87)

##
