The Layer for whatIsGround has not been set on the Player. Or the Floor has not been assigned the same Layer as whatIsGround.
If the values of GroundCheck X & GroundCheck Y are not big enough.
Ground Check Point gameObject is not assigned or is not low enough, relative to the Player with GroundCheck Y value included, to reach the Layer Ground beneath the player.
Set your Floor gameobject to the same Layer as ‘What Is Ground’.Set an empty gameobject to the ‘Ground Check Point’.
Ensure the Ground Check X & Y values are big enough for them to reach the floor.
Set What Is Ground Layer to an appropriate Layer.Ensure your empty gameobject used for the Ground Check Point is low enough/below the player’s model and box collider.
2. The Camera/Player is jittering/glitching.
Set Player’s RigidBody2D to Interpolate
Set Player’s RigidBody2D to Interpolate to prevent jittering.
[Interpolation solves most jittering issues, but when the player is moving at a fast enough speed, we can see the Player jitter backwards a few frames here and there. This is caused by the Camera not being able to match the Player’s speed.]
Set Player’s walkSpeed to a lower value
Or set Camera’s followSpeed to a higher value/[1]
Ensure the Walk Speed is not too fast.Ensure the Camera’s Follow Speed is fast enough.
Note: Setting Camera’s followSpeed to [1] will guarantee the Camera will follow the Player exactly.
[Part 2] Dash, Double Jump & Advanced Movement.
1. Dashing mechanic does not work.
[This issue is most commonly caused by a missing piece of code]
Ensure that all parts of the Dashing mechanic’s code in the PlayerController script is as follows:
That will be all for Part 1 & 2. I will soon be updating on the common issues for Part 3.
Hopefully this can help you on any issues you may have. However, if you find that your issues weren’t addressed or is a unique circumstance, you can submit a forum post to go into detail on your problem for further assistance.
Just wanted to add an extra note for Part 1 pointed out by @soulhealer6154 on YouTube:
Flipping non-uniformly scaled character sprites
If you have a character sprite that does not have a scale of (1, 1, 1), you may find that when moving the character around, your sprite’s X, Y and Z values will always change to 1. This may distort your sprite.
To fix this, you will need to modify the Flip() function on PlayerController as follows:
void Flip()
{
if (xAxis < 0)
{
transform.localScale = new Vector2(-1 -Mathf.Abs(transform.localScale.x), transform.localScale.y);
}
else if (xAxis > 0)
{
transform.localScale = new Vector2(1 Mathf.Abs(transform.localScale.x), transform.localScale.y);
}
}
What the code does is that instead of setting the scale to 1, we are using the GameObject’s current scale value, but using Mathf.Abs() on it to make sure that we always take the positive value. Then, when moving left, we take -Maths.Abs(), so that we always take the negative of the value. Of course, for the right-facing movement, we just take the default (positive) value.