Problem with a function (792284)

Sup.
Basiclly im trying to change 2 bool variables (inAMiddOfABoost, finishedBoost) through a function, and im setting them to true, and they still stay false. Maybe it has to do with the fact that this class extends the other one, but I dont remember that it has to do something with it. Thanks for helping.

    public void Boost(bool boosting, float boostSpd, float boostTime, bool inAMiddOfABoost, bool finishedBoost)
    {

        //cooldown starts
        if (waitBoostClock < boostCooldownTime)
        {
            //cooldown
            waitBoostClock += Time.deltaTime;

        }

        else
        {
            //if player hitting boost button
            if (boosting)
            {
                //letting know PlayerMovement that the player is boosting
                finishedBoost = false;
                inAMiddOfABoost = true;

                boostTimer += Time.deltaTime;

                //Limit the boost for time
                if (boostTimer < boostTime && waitBoostClock >= boostCooldownTime)

                    //if player looking left, boosting left
                    if (!m_FacingRight)
                    {
                        Vector3 targetVelocity = new Vector2(boostSpd * -1, m_Rigidbody2D.velocity.y);

                        //boost gravity
                        m_Rigidbody2D.gravityScale = 12;

                        m_Rigidbody2D.velocity = Vector3.SmoothDamp(m_Rigidbody2D.velocity, targetVelocity, ref m_Velocity, m_MovementSmoothing);
                    }
                    //if player idle of looking right, booting right
                    else
                    {
                        Vector3 targetVelocity = new Vector2(boostSpd * 1, m_Rigidbody2D.velocity.y);
                        m_Rigidbody2D.gravityScale = 12;
                        m_Rigidbody2D.velocity = Vector3.SmoothDamp(m_Rigidbody2D.velocity, targetVelocity, ref m_Velocity, m_MovementSmoothing);
                    }
                //leaving boost
                else if (boostTimer >= boostTime)
                {
                    //boost cooldown time **need to add to PlayerMovement
                    waitBoostClock = 0;
                    boostTimer = 0;

                    //letting know PlayerMovement that the player isn't moving
                    finishedBoost = true;
                    inAMiddOfABoost = false;

                    //reseting to normal gravity
                    m_Rigidbody2D.gravityScale = 8;


                }

When you pass a value type such as a bool (or int, or struct of any kind) into a method, C# makes a COPY of that value, and leaves the original alone. Therefore it doesn’t matter what you do to the value inside the method, it will not change whatever variable you passed into the method, because you are only changing a copy.

See Value types - C# reference | Microsoft Learn

If you want to get the value out you can use one of the following:

Oh ok thanks!

Check my edited response. Return works. If it’s not working for you, there’s some other error in your code. Use Debug.Log statements to make sure values match up with what you expect when you expect it.