Code not working

So I have this code:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class JumpUpgrade : MonoBehaviour
{
    private bool UpgradePressed;
    private bool Upgraded = false;
    private bool done;

    void Start()
    {
        UpgradePressed = false;
        done = false;
    }
    void Awake()
    {
        DontDestroyOnLoad(this.gameObject);
    }
    public void JumpMax(int JumpMax)
    {
        if (Upgraded == true)
        {
            JumpMax = JumpMax + 1;
            Upgraded = false;
        }
    }

    public void Coins(int Coins)
    {
        if (UpgradePressed == true)
        {
            if (Coins >= 10)
            {
                Coins = Coins - 10;
                Debug.Log("Upgrade succesfull");
                Upgraded = true;
                done = true;           
            }
            else    
            {
                Debug.Log("not enough coins");
                done = true;
            }                          
        }
        else
        {
            Debug.Log("NOT TRUE, NOT TRUE");
            done = true;
        }
    }

    public void JumpUpgrade1()
    {
        UpgradePressed = true;
        Debug.Log("click");
        if (done == true)
        {
            Debug.Log("Done");
            UpgradePressed = false;
            done = false;
        }
    }

}

The problem is it will ONLY debug: Not true, Not true. And it debugs click if I click. Does someone spot the problem why it only debugs Not true and click?

Probably an order of operations error. But I don’t know how you’re calling JumpUpgrade1 and Coins

From the limited view you gave us, only Start() and Awake() are Unity functions.

Everything else is dependent on code you didn’t share.

But you’re on the right track with lots of Debug.Log() statements; that’s often the only way to track stuff like this down, especially when breakpointing a running game makes it unplayable in certain instances.

To help gain more insight into your problem, I recommend liberally sprinkling Debug.Log() statements through your code to display information in realtime, and I mean even in the other code that you DIDN’T post above, what is calling these things.

Doing this should help you answer these types of questions:

  • is this code even running? which parts are running? how often does it run?
  • what are the values of the variables involved? Are they initialized?

Knowing this information will help you reason about the behavior you are seeing.