Forum begins after the advertisement:

[Part 1-2] Common Issues & Bugfixes

Home Forums Video Game Tutorial Series Creating a Metroidvania in Unity [Part 1-2] Common Issues & Bugfixes

Viewing 1 post (of 1 total)
  • Author
  • #13608
    Joseph Tang

    This post is to compile and go through some common issues that viewers and readers may face when following the Metroidvania series, as well as some solutions that may fix or solve the issues.

    Some solutions given will also be under the assumptions that the code for the mechanic is 1:1 for the relevant part.

    In this post, we will go through
    [Part 1]

    • 1. Player is not Jumping
    • 2. The Camera/Player is jittering/glitching

    [Part 2]

    • 1. Dashing mechanic does not work.
    • 2. Double Jump is not working.
    • 3. Dashing when left-clicking/attacking [Part 3 mechanic].

    [Part 1] Movement & Camera

    1. Player is not Jumping

    • 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:
        private bool canDash = true;
        private bool dashed;
        void Update()
            if (pState.dashing) return;
        void StartDash()
            if (Input.GetButtonDown("Dash") && canDash && !dashed)
                dashed = true;
            if (Grounded())
                dashed = false;
        IEnumerator Dash()
            canDash = false;
            pState.dashing = true;
            rb.gravityScale = 0;
            rb.velocity = new Vector2(transform.localScale.x * dashSpeed, 0);
            if (Grounded()) Instantiate(dashEffect, transform);
            yield return new WaitForSeconds(dashTime);
            rb.gravityScale = gravity;
            pState.dashing = false;
            yield return new WaitForSeconds(dashCooldown);
            canDash = true;

    2. Double Jump is not working.

    [While this can be caused by missing code, the actual code for the mechanic relies on variables that can never fire if the value is left at [0]]

    • Ensure all the values for Double Jump in the Inspector are set.

    Ensure that all values are above [0].

    3. Dashing when left-clicking/attacking [Part 3 mechanic].

    • Remove the “Mouse 0” keybind from “Alt Positive Button” under the Dash input from the Input Manager.

    Remove any input under Alt Positive Button.

    That will be all for Part 1 & 2. I will soon be updating on the common issues for Part 3 & 4.
    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.

Viewing 1 post (of 1 total)
  • You must be logged in to reply to this topic.

Go to Login Page →

Advertisement below: