Why is my game running different on build?

I tried to make my code run frameindependent using Time,deltaTime in FixedUpdate(), and thought i had succeded, since it ran at the same speed in both Vsync on and off mode so the framerate was different but it still worked the same.
But once its compiled and run outside of the editors player, it behaves completely different, the timespans in which the Actions can be performed, seem the same.
For example a jump function that allows you to jump for one second still lets you jump for one second, but the maximum height and speed of the jump differ.
Another problem is that the different speedcalculations, jumpspeed/ runspeed are not just all slowed down or speed up at the same time, but only some of them get up and some of them downscaled.
Has anybody an idea, why this happens?

As i now you dont need to set time.delta time in fixed update because it should already be frame independent. Maybe this fix your problem.

[ [1]: using UnityEngine;

public class PlayerMovement : MonoBehaviour
{
PlanterController plantercontroller;

[SerializeField] private LayerMask groundlayerMask;
[SerializeField] private LayerMask balllayerMask;

private BoxCollider2D boxCollider2D;
public BoxCollider2D walljumpcheckbox;
private Rigidbody2D rigidbody2D;
public Collider2D[] hitboxes;
Vector2 usualHeight;
Vector2 halfHeight;
float normallocalscale;
public Animator animator;
bool playjumpani;
bool playrunani;
bool playduckani;
public bool playbaseslashani;
public bool playduckslashani;
public bool playairslashani;

public float slashanispeed;
public float maxslashanispeed = 25f;

public float duckslashanispeed;
public float maxduckslashanispeed = 25f;

public float airslashanispeed;
public float maxairslashanispeed = 25f;

public float baseslashexposedtime = 0f;
public float playerSpeed;
float speedmultiplier=1;
public float dogeSpeed;
public float jumpspeed = 200f;
public float floatspeed= 500f;
public float acceleration = 0;
public float maxacceleration = 40f;
public float dogeSpeedMultiplier = 10f;
public float defaultplayerspeed = 1000f;
public float maxplayerspeed = 3f;
public float maxComforttime = 0.5f;
public float weretomove;
public float slideValue = 1f;
public float lastDirectionPressed = 0;

public float Ducktime;
public float RightCameraMoveTimer;
public float LeftCameraMoveTimer;

public float hasSpacebeenPressedmidairMax = 1f;
public float maxFloattime = 2f;
public float walljumpdegrader = 0.75f;
public float smashspeed = 200f;
public bool canIwallJumpLeft;
public bool canIwallJumpRight;
bool jumpedAlready = false;
bool easyWalljumpwasgranted;
public bool walljumpedalready;
bool performingGroundSmash;
public bool draging;
public bool dashing;
public bool dashend;
public bool climbingUpsideDown;
bool ducking;

//state of the Jump
public bool leavingGround;
public bool falling;
public bool flapping;
public bool landing;

bool climbing;

float jumptime;
float maxeasywalljumptime = 200f;
public float easywalljumptimer = 200;
public float comforttime;
public float maxjumpheight = 1f;
public float floattime;
bool canifloat = false;
bool haveIbeenfloating;
public float hasSpacebeenpressedMidair = 0;
public float dogetime = 0f;
public float maxDogeTime = 0.75f;
public float friction = 1f;
public float airlag;
public float maxairlag = 0.25f;

private Vector2 moveDir;
private Vector2 verticalDir;
Vector2 rsmoveDir;
//ButtonInputbools
public bool rightbuttondown;
public bool rightbutton;
public bool rightbuttonup;

public bool leftbuttondown;
public bool leftbutton;
public bool leftbuttonup;

public bool rsrightbuttondown;
public bool rsrightbutton;
public bool rsrightbuttonup;

public bool rsleftbuttondown;
public bool rsleftbutton;
public bool rsleftbuttonup;

public bool upbuttondown;
public bool upbutton;
public bool upbuttonup;

public bool rsupbuttondown;
public bool rsupbutton;
public bool rsupbuttonup;

public bool downbuttondown;
public bool downbutton;
public bool downbuttonup;

public bool rsdownbuttondown;
public bool rsdownbutton;
public bool rsdownbuttonup;

public bool attackbuttondown;
public bool attackbutton;
public bool attackbuttonup;

public bool jumpbuttondown;
public bool jumpbutton;
public bool jumpbuttonup;

public bool dashbuttondown;
public bool dashbutton;
public bool dashbuttonup;

public bool holdbutton;
public bool holdbuttondown;
public bool holdbuttonup;

public bool sprintbutton;

// UI

//Stats
public float maxStamina = 100;

// current Stats
public float currentStamina;

// Start is called before the first frame update
void Start()
{

    rigidbody2D = transform.GetComponent<Rigidbody2D>();
    //rigidbody2D.constraints = RigidbodyConstraints2D.FreezeRotation;
    boxCollider2D = transform.GetComponent<BoxCollider2D>();

    normallocalscale = transform.localScale.x;

    jumptime = maxjumpheight;
    floattime = 0;
    comforttime = 0;
    usualHeight = boxCollider2D.size;
    halfHeight.y = (usualHeight.y / 2f);
    currentStamina = maxStamina;
    GameObject.Find("Staminabar").GetComponent<PlantersStaminaBar>().SetMaxStamina(maxStamina);
    baseslashexposedtime = 0;
}
void JumpButtonDownTrue()
{
    jumpbuttondown = true;
}

void Jumptrue()
{

    jumpbutton = true;
}
void Jumpfalse()
{

    jumpbutton = false;
}
void JumpButtonUptrue()
{
    jumpbuttonup = true;
}

void Dashtrue()
{

    dashbutton = true;
}
void Dashfalse()
{

    dashbutton = false;
}
void DashButtonUptrue()
{
    dashbuttonup = true;
}
void Sprinttrue()
{

    sprintbutton = true;
}
void Sprintfalse()
{

    sprintbutton = false;
}
void Holdtrue()
{

    holdbutton = true;
}
void Holdfalse()
{

    holdbutton = false;
}

void AttackButtonDownTrue()
{
    attackbuttondown = true;
}
void AttackTrue() 
{
    attackbutton = true;
}

void AttackFalse() 
{
    attackbutton = false;
}

void AttackButtonUpTrue()
{
    attackbuttonup = true;
}

void Awake()
{
    plantercontroller = new PlanterController();
    plantercontroller.BaseMovementPlanter.Jump.started += lmdaex => JumpButtonDownTrue();
    plantercontroller.BaseMovementPlanter.Jump.performed += lmdaex => Jumptrue();
    plantercontroller.BaseMovementPlanter.Jump.canceled += lmdaex => Jumpfalse();
    plantercontroller.BaseMovementPlanter.Jump.canceled += lmdaex => JumpButtonUptrue();

    plantercontroller.BaseMovementPlanter.Attack.started += lmdaex => AttackButtonDownTrue();
    plantercontroller.BaseMovementPlanter.Attack.performed += lmdaex => AttackTrue();
    plantercontroller.BaseMovementPlanter.Attack.canceled += lmdaex => AttackFalse();
    plantercontroller.BaseMovementPlanter.Attack.canceled += lmdaex => AttackButtonUpTrue();

    plantercontroller.BaseMovementPlanter.Dash.performed += lmdaex => Dashtrue();
    plantercontroller.BaseMovementPlanter.Dash.canceled += lmdaex => Dashfalse();
    plantercontroller.BaseMovementPlanter.Dash.canceled += lmdaex => DashButtonUptrue();

    plantercontroller.BaseMovementPlanter.Sprint.performed += lmdaex => Sprinttrue();
    plantercontroller.BaseMovementPlanter.Sprint.canceled += lmdaex => Sprintfalse();

    plantercontroller.BaseMovementPlanter.Hold.performed += lmdaex => Holdtrue();
    plantercontroller.BaseMovementPlanter.Hold.canceled += lmdaex => Holdfalse();

    plantercontroller.BaseMovementPlanter.Move.performed += lmdaex => moveDir = lmdaex.ReadValue<Vector2>();
    plantercontroller.BaseMovementPlanter.Move.canceled += lmdaex => moveDir = Vector2.zero;


    plantercontroller.BaseMovementPlanter.RightStickMove.performed += lmdaex => rsmoveDir = lmdaex.ReadValue<Vector2>();
    plantercontroller.BaseMovementPlanter.Move.canceled += lmdaex => rsmoveDir = Vector2.zero;
}

void OnEnable()
{

    plantercontroller.BaseMovementPlanter.Enable();

}

void FixedUpdate()
{
     if (jumpbutton) { playjumpani = true; }
    if (!jumpbutton || OnGround()) { playjumpani = false; }
    if (downbutton) { playduckani = true; }
    if (!downbutton) { playduckani = false; }
    animator.SetBool("Runing", playrunani);
    animator.SetBool("Jumping", playjumpani);
    animator.SetBool("Duck", playduckani);
    animator.SetBool("BaseSlash", playbaseslashani);

    animator.SetBool("DuckSlash", playduckslashani);
    animator.SetBool("AirSlash", playairslashani);
    animator.SetBool("Falling", falling);
    animator.SetBool("Dashing", dashing);

    //StaminaRegen
    if (!attackbuttondown && (currentStamina < maxStamina) == true && !attackbutton && !sprintbutton)
    { GainStam((50f * Time.deltaTime)); }

    ComforttimeCalc();

    Wallslide();
    Climb();
    if (IsGroundAbove() == true && holdbutton && !dashbutton && !jumpbutton && !OnGround() && !ContactLeft() && !ContactRight())
    {
        rigidbody2D.velocity = Vector2.up * 10f;
        friction = 0.5f;
        climbingUpsideDown = true;
    }
    else climbingUpsideDown = false;

    JumptimeCalc();
    Jumpstate();

    SpeedCalc();
    FloattimeCalc();
    Slashs();
    Jump();
    GroundSmash();
    DogeDash();
    Horizontal();

    Cameraoffset();

    jumpbuttondown = false;
    jumpbuttonup = false;
    attackbuttondown = false;
    attackbuttonup = false;
    dashbuttonup = false;

    if (lastDirectionPressed != 0) { transform.localScale = new Vector3(normallocalscale * lastDirectionPressed, transform.localScale.y, transform.localScale.z); }

    GameObject.Find("Staminabar").GetComponent<PlantersStaminaBar>().SetStamina(currentStamina);

    OnGround();
    IsGroundAbove();
    OnBall();
    ContactLeft();
    ContactLeftBall();
    ContactRight();
    ContactRightBall();
    GenerousWalljumpleft();
    GenerousBalljumpleft();
    GenerousWalljumpright();
    GenerousBalljumpright();

    Drag();

    if (moveDir.x > 0)
    {
        rightbutton = true;
        leftbutton = false;
    }
    if (moveDir.x < 0)
    {
        leftbutton = true;
        rightbutton = false;
    }
    if (moveDir.x == 0)
    {
        rightbutton = false;
        leftbutton = false;
    }

    if (rsmoveDir.x > 0)
    {
        rsrightbutton = true;
        rsleftbutton = false;
    }
    if (rsmoveDir.x < 0)
    {
        rsleftbutton = true;
        rsrightbutton = false;
    }
    if (rsmoveDir.x == 0)
    {
        rsrightbutton = false;
        rsleftbutton = false;
    }

    if (moveDir.y > 0)
    {
        upbutton = true;
    }
    if (moveDir.y < -0.5)
    {
        downbutton = true;
    }
    if (moveDir.y == 0)
    {
        downbutton = false;
        upbutton = false;
    }

    if (rsmoveDir.y > 0)
    {
        rsupbutton = true;
    }
    if (rsmoveDir.y < -0.5)
    {
        rsdownbutton = true;
    }
    if (rsmoveDir.y == 0)
    {
        rsdownbutton = false;
        rsupbutton = false;
    }
}

void Update()
{

   

}

void Cameraoffset()
{

    if (rsrightbutton == true)
    {

        float activateRightCamera = 100.0f;

        if (RightCameraMoveTimer < activateRightCamera)
        {

            RightCameraMoveTimer = RightCameraMoveTimer + 1f;

        }
    }
    if (rsrightbutton == false)
    {

        RightCameraMoveTimer = 0;

    }

    if (rsleftbutton == true)
    {

        float activateLeftCamera = 100.0f;

        if (LeftCameraMoveTimer < activateLeftCamera)
        {

            LeftCameraMoveTimer = LeftCameraMoveTimer + 1f;

        }

    }
    if (rsleftbutton == false)
    {

        LeftCameraMoveTimer = 0;

    }

    if (rsdownbutton == true)
    {

        float activateDuckcamera = 150.0f;

        if (Ducktime < activateDuckcamera)
        {

            Ducktime = Ducktime + 1f;

        }

    }
    if (rsdownbutton == false)
    {

        Ducktime = 0;

    }

}

void SpeedCalc()
{
    weretomove = 0;

    if (jumpbuttonup)
    {
        easyWalljumpwasgranted = true;
        easywalljumptimer = maxeasywalljumptime;
    }

    if (rightbutton || leftbutton || jumpbutton)
    {
        playerSpeed = defaultplayerspeed;

        if (sprintbutton && currentStamina > 10)
        {
            speedmultiplier = maxplayerspeed;
            DrainStamina(0.5f);

        }
        else speedmultiplier = 1;
    }

    if (!ContactLeft() && !ContactRight())
    {
        walljumpedalready = false;

    }

    if (downbutton && !climbingUpsideDown && OnGround())
    {

        friction = 0.25f;

        Duck();

        if (ducking == false)
        {
            transform.position = new Vector2(transform.position.x, transform.position.y - boxCollider2D.bounds.extents.y);
        }
        ducking = true;
    }
    if (!downbutton)
    {

        boxCollider2D.size = new Vector2(boxCollider2D.size.x, usualHeight.y);
        friction = 1f;
        ducking = false;
    }
    if (rightbutton && acceleration < maxacceleration || leftbutton && acceleration < maxacceleration)
    {
        acceleration = acceleration + 2f;

    }
    if (!rightbutton && acceleration > 0 && !leftbutton)
    {
        acceleration = acceleration - (1f * airlag);
    }
    if (!OnGround() && !OnBall() && !climbingUpsideDown)
    {
        airlag = maxairlag;
        friction = 1f;
    }
    else airlag = 1;

    if (!OnGround() && !OnBall() && leftbutton && !climbingUpsideDown || !OnGround() && !OnBall() && rightbutton && !climbingUpsideDown)
    {

        acceleration = maxacceleration;

    }

    if ((ContactRight() == true && !leftbutton) && (!OnGround()) || (ContactLeft() == true && !rightbutton) && (!OnGround()) || attackbuttondown && OnGround() || (baseslashexposedtime <= 0) == false && OnGround())

    { playerSpeed = 0; }

    if (GenerousWalljumpright() && leftbuttondown && (jumpedAlready == false) && (walljumpedalready == false) || GenerousBalljumpright() && leftbuttondown && (jumpedAlready == false) && (walljumpedalready == false))
    {

        jumptime = maxjumpheight * walljumpdegrader;
        walljumpedalready = true;

    }

    if (GenerousWalljumpleft() && rightbuttondown && (jumpedAlready == false) && (walljumpedalready == false) || GenerousBalljumpleft() && rightbuttondown && (jumpedAlready == false) && (walljumpedalready == false))
    {

        jumptime = maxjumpheight * walljumpdegrader;
        walljumpedalready = true;
    }

    if (GenerousWalljumpleft() && leftbuttondown && (jumpedAlready == false) && (walljumpedalready == false) || GenerousBalljumpleft() && leftbuttondown && (jumpedAlready == false) && (walljumpedalready == false))
    {

        jumptime = maxjumpheight * walljumpdegrader;
        walljumpedalready = true;
    }

    if (GenerousWalljumpright() && rightbuttondown && (jumpedAlready == false) && (walljumpedalready == false) || GenerousBalljumpright() && rightbuttondown && (jumpedAlready == false) && (walljumpedalready == false))
    {

        jumptime = maxjumpheight * walljumpdegrader;
        walljumpedalready = true;

    }

    if (rightbutton && (OnGround() == true) || leftbutton && (OnGround() == true)) { playrunani = true; }
    if (!rightbutton && !leftbutton || (OnGround() == false)) { playrunani = false; }
}

void Jump()
{

    if (jumpbutton && !performingGroundSmash && jumpedAlready == false && jumptime > 0 )
    {

        rigidbody2D.velocity = Vector2.up * (jumpspeed  * jumptime);

    }

    if (jumpbuttonup && hasSpacebeenpressedMidair < 1)
    {

        canifloat = true;

    }
    else if (jumpbuttonup && hasSpacebeenpressedMidair <= 10)
    {
        canifloat = false;
    }

    if (canifloat == true && (jumpbutton) && (floattime > 0))
    {
        hasSpacebeenpressedMidair = hasSpacebeenpressedMidair + (1f );
        rigidbody2D.velocity = Vector2.up * (floatspeed );

        // Debug.Log(hasSpacebeenpressedMidair);
    }
    if (jumpbuttonup || jumptime <= 0)
    {

        jumpedAlready = true;

    }

    //Jumpanimations  
    if (jumpbutton) { playjumpani = true; }
    if (!jumpbutton || OnGround()) { playjumpani = false; }
    if (downbutton && !attackbutton) { playduckani = true; }
    if (!downbutton || attackbuttondown) { playduckani = false; }
}

void GroundSmash()
{

    if (dashbutton && !OnGround() && downbutton && !jumpbutton)
    {

        rigidbody2D.velocity = Vector2.down * (smashspeed );
        performingGroundSmash = true;
        friction = 0.3f;
    }
    if (OnGround() && !dashbutton || OnBall() && !dashbutton) { performingGroundSmash = false; }
}

void DogeDash()
{

    if ((!downbutton))
    {
        if ((dashbutton) && (dogetime < maxDogeTime))
        {

            if ((currentStamina > 50) == true)
            {
                dogetime = dogetime + (1f );
                dogeSpeed = defaultplayerspeed *dogeSpeedMultiplier * ((maxDogeTime - dogetime) * 0.1f);
                DrainStamina(20*dogetime);
                dashing = true;
                acceleration = maxacceleration;
            }
        }
        else dashing = false;
        if (dashbuttonup)
        {
            dashing = false;

        }
        if (!dashbutton && (currentStamina > 10) == true)
        {

            dogetime = 0;

        }

    }
    if (downbutton && OnGround())
    {

        dogetime = maxDogeTime;

    }
    if (currentStamina < 50) { dogeSpeed = 0; }

}

void Wallslide()
{

    if ((ContactRight() == true && rightbutton && !holdbutton && !attackbutton) && !jumpbutton || (ContactLeft() == true && leftbutton && !holdbutton & !attackbutton) && !jumpbutton)
    {
        if (!downbutton)
        {
            slideValue = 0.25f;
        }
        if (downbutton)
        {
            slideValue = 0.75f;
        }
    }
    else slideValue = 1f;

}
void Climb()
{
    if (ContactRight() == true && holdbutton && !jumpbutton || ContactLeft() == true && holdbutton && !jumpbutton)
    {
        rigidbody2D.velocity = Vector2.up * 1.9f;
        if (upbutton)
        {

            rigidbody2D.velocity = Vector2.up * 5f;

        }
        if (downbutton)
        {
            rigidbody2D.velocity = Vector2.down * 10f;
        }

    }

}

void Duck()
{

    boxCollider2D.size = new Vector2(boxCollider2D.size.x, halfHeight.y);
    dashing = false;

}

void Horizontal()
{

    if (leftbutton && weretomove == 0 || rightbutton && weretomove == 0)
    {

        if (leftbutton) { weretomove = -1; lastDirectionPressed = -1; }
        if (rightbutton) { weretomove = +1; lastDirectionPressed = +1; }

    }
    if (leftbutton && rightbutton)
    {

        weretomove = 0;
        playerSpeed = 0;
        acceleration = 0;

    }
    //if(!leftbutton&&!rightbutton){  playerSpeed = 0;}
    rigidbody2D.velocity = new Vector3((playerSpeed*speedmultiplier* lastDirectionPressed * (acceleration / maxacceleration))  * friction, rigidbody2D.velocity.y * slideValue , 0);
    if (dashbutton) { rigidbody2D.velocity = new Vector3(dogeSpeed * lastDirectionPressed , rigidbody2D.velocity.y, 0); }
    if (dashbutton && (maxDogeTime - dogetime) == 0 || dashbutton && dogeSpeed == 0) { rigidbody2D.velocity = new Vector3(playerSpeed*speedmultiplier * weretomove * (acceleration / maxacceleration)*friction, rigidbody2D.velocity.y * slideValue , 0); }

    //   transform.position = transform.position + new Vector3(playerSpeed * lastDirectionPressed*(acceleration/maxacceleration)*friction  *Time.deltaTime , rigidbody2D.velocity.y * slideValue*Time.deltaTime,0 );
    //if (dashbutton) {transform.position = transform.position + new Vector3(dogeSpeed * lastDirectionPressed*Time.deltaTime, rigidbody2D.velocity.y*Time.deltaTime,0); }
    //if (dashbutton && (maxDogeTime - dogetime) == 0||dashbutton && dogeSpeed ==0) {transform.position = transform.position + new Vector3(playerSpeed * weretomove , rigidbody2D.velocity.y * slideValue ,0); }
}

bool OnGround()
{

    RaycastHit2D raycastHit = Physics2D.BoxCast(boxCollider2D.bounds.center, boxCollider2D.bounds.size, 0f, Vector2.down, 0.1f, groundlayerMask);
    Color rayColor;
    if (raycastHit.collider != null)
    {
        rayColor = Color.green;
    }
    else rayColor = Color.red;

    Debug.DrawRay(boxCollider2D.bounds.center, Vector2.down * (boxCollider2D.bounds.extents.y + 0.1f));
    return raycastHit.collider != null;
}
bool IsGroundAbove()
{

    RaycastHit2D raycastHit = Physics2D.BoxCast(boxCollider2D.bounds.center, boxCollider2D.bounds.size, 1f, Vector2.up, 1f, groundlayerMask);
    Color rayColor;
    if (raycastHit.collider != null)
    {
        rayColor = Color.green;
    }
    else rayColor = Color.red;

    Debug.DrawRay(boxCollider2D.bounds.center, Vector2.up * (boxCollider2D.bounds.extents.y + 0.1f));
    return raycastHit.collider != null;
}

bool OnBall()
{
    RaycastHit2D raycastHit = Physics2D.BoxCast(boxCollider2D.bounds.center, boxCollider2D.bounds.size, 0f, Vector2.down, 0.1f, balllayerMask);
    Color rayColor;
    if (raycastHit.collider != null)
    {
        rayColor = Color.green;
    }
    else rayColor = Color.red;

    Debug.DrawRay(boxCollider2D.bounds.center, Vector2.down * (boxCollider2D.bounds.extents.y + 0.1f));
    return raycastHit.collider != null;
}

bool ContactLeft()
{
    RaycastHit2D raycastHit = Physics2D.BoxCast(boxCollider2D.bounds.center, boxCollider2D.bounds.size, 0.1f, Vector2.left, 0.1f, groundlayerMask);
    Color rayColor;
    if (raycastHit.collider != null)
    { rayColor = Color.green; }
    else rayColor = Color.red;

    Debug.DrawRay(boxCollider2D.bounds.center, Vector2.left * (boxCollider2D.bounds.extents.x + 0.1f));
    return raycastHit.collider != null;
}

bool ContactRight()
{

    RaycastHit2D raycastHit = Physics2D.BoxCast(boxCollider2D.bounds.center, boxCollider2D.bounds.size, 0.1f, Vector2.right, 0.1f, groundlayerMask);
    Color rayColor;
    if (raycastHit.collider != null)
    {
        rayColor = Color.green;
    }
    else rayColor = Color.red;

    Debug.DrawRay(boxCollider2D.bounds.center, Vector2.right * (boxCollider2D.bounds.extents.x + 0.1f));
    return raycastHit.collider != null;
}

bool ContactRightBall()
{
    RaycastHit2D raycastHit = Physics2D.BoxCast(boxCollider2D.bounds.center, boxCollider2D.bounds.size, 0.1f, Vector2.right, 0.1f, balllayerMask);
    Color rayColor;
    if (raycastHit.collider != null)
    {
        rayColor = Color.green;
    }
    else rayColor = Color.red;

    Debug.DrawRay(boxCollider2D.bounds.center, Vector2.right * (boxCollider2D.bounds.extents.x + 0.1f));
    return raycastHit.collider != null;
}

bool ContactLeftBall()
{
    RaycastHit2D raycastHit = Physics2D.BoxCast(boxCollider2D.bounds.center, boxCollider2D.bounds.size, 0.1f, Vector2.left, 0.1f, balllayerMask);
    Color rayColor;
    if (raycastHit.collider != null)
    { rayColor = Color.green; }
    else rayColor = Color.red;

    Debug.DrawRay(boxCollider2D.bounds.center, Vector2.left * (boxCollider2D.bounds.extents.x + 0.1f));
    return raycastHit.collider != null;
}

bool GenerousWalljumpright()
{
    RaycastHit2D raycastHit = Physics2D.BoxCast(boxCollider2D.bounds.center, boxCollider2D.bounds.size, 1.5f, Vector2.right, 1.5f, groundlayerMask);
    Color rayColor;
    if (raycastHit.collider != null)
    {
        rayColor = Color.blue;
    }
    else rayColor = Color.red;

    Debug.DrawRay(boxCollider2D.bounds.center, Vector2.right * (boxCollider2D.bounds.extents.x + 1.5f));
    return raycastHit.collider != null;
}

bool GenerousWalljumpleft()
{

    RaycastHit2D raycastHit = Physics2D.BoxCast(boxCollider2D.bounds.center, boxCollider2D.bounds.size, 1.5f, Vector2.left, 1.5f, groundlayerMask);
    Color rayColor;
    if (raycastHit.collider != null)
    {
        rayColor = Color.blue;
    }
    else rayColor = Color.red;

    Debug.DrawRay(boxCollider2D.bounds.center, Vector2.left * (boxCollider2D.bounds.extents.x + 1.5f));
    return raycastHit.collider != null;

}

bool GenerousBalljumpleft()
{

    RaycastHit2D raycastHit = Physics2D.BoxCast(boxCollider2D.bounds.center, boxCollider2D.bounds.size, 0.1f, Vector2.left, 0.1f, balllayerMask);
    Color rayColor;
    if (raycastHit.collider != null)
    {
        rayColor = Color.blue; //Debug.Log("theres something right");
    }
    else rayColor = Color.red;
    // Debug.Log("theres nothing right");

    Debug.DrawRay(boxCollider2D.bounds.center, Vector2.left * (boxCollider2D.bounds.extents.x + 0.1f));
    return raycastHit.collider != null;

}

bool GenerousBalljumpright()
{
    RaycastHit2D raycastHit = Physics2D.BoxCast(boxCollider2D.bounds.center, boxCollider2D.bounds.size, 0.1f, Vector2.right, 0.1f, balllayerMask);
    Color rayColor;
    if (raycastHit.collider != null)
    {
        rayColor = Color.blue; //Debug.Log("theres something right");
    }
    else rayColor = Color.red;
    // Debug.Log("theres nothing right");

    Debug.DrawRay(boxCollider2D.bounds.center, Vector2.right * (boxCollider2D.bounds.extents.x + 0.1f));
    return raycastHit.collider != null;
}

// used to get if Player is rising,falling,or landing
void Jumpstate()
{
    //rising
    if (OnGround() == true && (jumpbuttondown == true))
    {
        leavingGround = true;
    }
    //jumpclimax        
    if (jumptime <= 0 || jumpbuttonup)
    {
        leavingGround = false;
        playjumpani = false;
    }
    //falling        
    if ((!OnGround()) && (!jumpbutton))
    {
        falling = true;
    }
    else falling = false;
    //flapping/gliding
    if (canifloat == true && (jumpbutton) && (floattime > 0))
    {
        flapping = true;
    }
    else flapping = false;
}

void JumptimeCalc()
{

    if (OnGround() == false && jumptime > 0)
    {

        jumptime = jumptime - (1f );
        //Debug.Log(jumptime);
    }
    if (OnGround() == true && !jumpbutton || OnBall() && !jumpbutton || comforttime > 0 && comforttime <= maxComforttime  && !jumpbutton)
    {
        jumptime = maxjumpheight;
        jumpedAlready = false;

    }
    if (comforttime<=0&&!jumpbutton&&!OnGround()) 
    {
        jumptime = 0;
    }

}

void FloattimeCalc()
{

    if (canifloat == true)
    {
        floattime = maxFloattime;

    }

    else if (floattime > 0 && jumpbutton && canifloat == true)
    {
        floattime = floattime - 1f;

    }

    if (OnGround() == true && !jumpbutton || ContactLeft() == true || ContactRight() == true || OnBall() && !jumpbutton)
    {
        floattime = 0f;

    }
    if (floattime == 0 || hasSpacebeenpressedMidair > hasSpacebeenPressedmidairMax)
    {
        canifloat = false;
        hasSpacebeenpressedMidair = 0;

    }

}

void ComforttimeCalc()
{
    if (jumpbutton) { comforttime = 0; }

    if (!jumpbutton)
    {

        if (ContactLeft() == true || ContactRight() == true || ContactLeftBall() == true || ContactRightBall() == true)
        {

            comforttime = maxComforttime;
        }
    }
    if (OnGround() == true && (!jumpbutton))
    {
        comforttime = maxComforttime / 2;
    }

    if (ContactLeft() == false || ContactRight() == false || ContactLeftBall() == false || ContactRightBall() == false || OnGround() == false)
    {

        comforttime = comforttime - (1f);
    }

}

void AttackOutput()
{
    if (attackbutton)
    { Slash1(hitboxes[0]); }

}

void Slash1(Collider2D col)
{
    Collider2D[] col1 = Physics2D.OverlapBoxAll(col.bounds.center, col.bounds.extents, 0f, LayerMask.GetMask("Hitboxslash1"));
    foreach (Collider2D c in col1)
    {

        if (c.transform.root == transform)
        {
            continue;
            Debug.Log(c.name);
        }

    }
}

void Slashs()
{
    //BaseSlash
    if (OnGround())
    {

        if (attackbuttondown && !jumpbutton && currentStamina >= 5 && !downbutton && slashanispeed != maxslashanispeed)
        {
            slashanispeed = maxslashanispeed;
            DrainStamina(1);
            baseslashexposedtime = 20f;
        }
        if (attackbutton)
        {
            slashanispeed = slashanispeed - 1f;

            if (baseslashexposedtime > 0) { baseslashexposedtime -= 1f; }
        }
        if (attackbuttonup)
        {
            slashanispeed = 0f;

        }
        if (slashanispeed > 0)
        {
            playbaseslashani = true;

        }
        if (slashanispeed <= 0)
        {
            playbaseslashani = false;
        }
        if (baseslashexposedtime > 0) { baseslashexposedtime -= 1f; }
    }
    //Duckslash
    if (attackbuttondown && currentStamina >= 5 && downbutton && duckslashanispeed != maxduckslashanispeed)
    {
        duckslashanispeed = maxduckslashanispeed;
        DrainStamina(10);
        baseslashexposedtime = 20f;
    }
    if (attackbutton)
    {
        duckslashanispeed = duckslashanispeed - 1f;

        if (baseslashexposedtime > 0) { baseslashexposedtime -= 1f; }
    }
    if (attackbuttonup)
    {
        duckslashanispeed = 0f;

    }
    if (duckslashanispeed > 0)
    {
        playduckslashani = true;

    }
    if (duckslashanispeed <= 0)
    {
        playduckslashani = false;
    }
    if (baseslashexposedtime > 0) { baseslashexposedtime -= 1f; }

    //AirSlash
    if (!OnGround())
    {
        if (attackbuttondown && currentStamina >= 7 && !jumpbutton && !downbutton && airslashanispeed != maxairslashanispeed)
        {
            airslashanispeed = maxairslashanispeed;
            DrainStamina(0.5f);
            baseslashexposedtime = 35f;
        }
        if (attackbutton)
        {
            airslashanispeed = airslashanispeed - 1f;

            if (baseslashexposedtime > 0) { baseslashexposedtime -= 1f; }
        }
        if (attackbuttonup)
        {
            airslashanispeed = 0f;
            rigidbody2D.constraints = RigidbodyConstraints2D.None;
            rigidbody2D.rotation = 0f;
            rigidbody2D.constraints = RigidbodyConstraints2D.FreezeRotation;

        }
        if (airslashanispeed > 0)
        {
            playairslashani = true;
            rigidbody2D.constraints = RigidbodyConstraints2D.FreezePositionY;
        }
        if (airslashanispeed <= 0)
        {
            playairslashani = false;
            rigidbody2D.constraints = RigidbodyConstraints2D.None;
            rigidbody2D.rotation = 0f;
            rigidbody2D.constraints = RigidbodyConstraints2D.FreezeRotation;
        }
        if (baseslashexposedtime > 0) { baseslashexposedtime -= 1f; }
        if (baseslashexposedtime <= 0)
        {

            rigidbody2D.constraints = RigidbodyConstraints2D.None;
            rigidbody2D.rotation = 0f;
            rigidbody2D.constraints = RigidbodyConstraints2D.FreezeRotation;
        }

    }

}
void Drag()
{

    if (holdbutton && ContactLeftBall() || holdbutton && ContactRightBall())
    {

        draging = true;

    }
    if (!holdbutton || !holdbutton)
    {
        draging = false;

    }
}

void DrainStamina(float drainstam)
{

    currentStamina -= drainstam;

}

void GainStam(float gainstam)
{
    currentStamina += gainstam;
}

}][1]

This is the script im having Problems with, sorry that its the full script, im new to this and dont know what the problem might be, my guess is that it calculates the speed variables not as i am expecting, wich is why the actions can be performed as long as they are supposed to, but have to high numbers given out to work with.