Help needed making level advance & some other messages

I’m following a tutorial & have just returned to it after walking away for some months. I’m very new to coding.
I’m getting confused trying to get the click upgrades to advance visually. I got the 1st click upgrade to advance visually but the 2nd click upgrade advancements made the 1st click upgrade advance visually so I altered it & now I am confused. I added in a copied piece of line 118 to 136 but now neither of the upgrades advance visually.

        string clickUpgrade1CostString;
        if (coins > 1000)
        {
            var exponent = (System.Math.Floor(System.Math.Log10(System.Math.Abs(clickUpgrade1Cost))));
            var mantissa = (clickUpgrade1Cost / System.Math.Pow(10, exponent));
            clickUpgrade1CostString = mantissa.ToString("F2") + "e" + exponent;
        }
        else
            clickUpgrade1CostString = clickUpgrade1Cost.ToString("F0");

        string clickUpgrade1LevelString;
        if (clickUpgrade1Level > 1000)
        {
            var exponent = (System.Math.Floor(System.Math.Log10(System.Math.Abs(clickUpgrade1Level))));
            var mantissa = (clickUpgrade1Level / System.Math.Pow(10, exponent));
            clickUpgrade1LevelString = mantissa.ToString("F2") + "e" + exponent;
        }
            clickUpgrade1LevelString = clickUpgrade1Level.ToString("F0");
        //clickUpgrade1Text.text = "Click Upgrade 1\nCost: " + clickUpgrade1Cost.ToString("F0") + " coins\nPower: +1 click\nLevel: " + clickUpgrade1Level;
       
        string clickUpgrade2CostString;
        if (coins > 1000)
        {
            var exponent = (System.Math.Floor(System.Math.Log10(System.Math.Abs(clickUpgrade2Cost))));
            var mantissa = (clickUpgrade2Cost / System.Math.Pow(10, exponent));
            clickUpgrade1CostString = mantissa.ToString("F2") + "e" + exponent;
        }
        else
            clickUpgrade2CostString = clickUpgrade2Cost.ToString("F0");

        string clickUpgrade2LevelString;
        if (clickUpgrade1Level > 1000)
        {
            var exponent = (System.Math.Floor(System.Math.Log10(System.Math.Abs(clickUpgrade2Level))));
            var mantissa = (clickUpgrade2Level / System.Math.Pow(10, exponent));
            clickUpgrade1LevelString = mantissa.ToString("F2") + "e" + exponent;
        }
        else
            clickUpgrade2LevelString = clickUpgrade2Level.ToString("F0");
        //clickUpgrade1Text.text = "Click Upgrade 1\nCost: " + clickUpgrade1Cost.ToString("F0") + " coins\nPower: +1 click\nLevel: " + clickUpgrade1Level;

the first line is 118 & I have the following messages (I only copied & pasted them)

Severity Code Description Project File Line Suppression State
Message IDE0059 Unnecessary assignment of a value to ‘clickUpgrade1CostString’ Assembly-CSharp, Assembly-CSharp.Player D:\Users\home\Unitylearningprojects\Learningproject1\New Unity Project (1)\Assets\Scripts\IdleGame.cs 123 Active
Message IDE0059 Unnecessary assignment of a value to ‘clickUpgrade1CostString’ Assembly-CSharp, Assembly-CSharp.Player D:\Users\home\Unitylearningprojects\Learningproject1\New Unity Project (1)\Assets\Scripts\IdleGame.cs 126 Active
Message IDE0059 Unnecessary assignment of a value to ‘clickUpgrade1LevelString’ Assembly-CSharp, Assembly-CSharp.Player D:\Users\home\Unitylearningprojects\Learningproject1\New Unity Project (1)\Assets\Scripts\IdleGame.cs 133 Active
Message IDE0059 Unnecessary assignment of a value to ‘clickUpgrade1LevelString’ Assembly-CSharp, Assembly-CSharp.Player D:\Users\home\Unitylearningprojects\Learningproject1\New Unity Project (1)\Assets\Scripts\IdleGame.cs 135 Active
Message IDE0059 Unnecessary assignment of a value to ‘clickUpgrade1CostString’ Assembly-CSharp, Assembly-CSharp.Player D:\Users\home\Unitylearningprojects\Learningproject1\New Unity Project (1)\Assets\Scripts\IdleGame.cs 143 Active
Message IDE0059 Unnecessary assignment of a value to ‘clickUpgrade2CostString’ Assembly-CSharp, Assembly-CSharp.Player D:\Users\home\Unitylearningprojects\Learningproject1\New Unity Project (1)\Assets\Scripts\IdleGame.cs 146 Active
Message IDE0059 Unnecessary assignment of a value to ‘clickUpgrade1LevelString’ Assembly-CSharp, Assembly-CSharp.Player D:\Users\home\Unitylearningprojects\Learningproject1\New Unity Project (1)\Assets\Scripts\IdleGame.cs 153 Active
Message IDE0059 Unnecessary assignment of a value to ‘clickUpgrade2LevelString’ Assembly-CSharp, Assembly-CSharp.Player D:\Users\home\Unitylearningprojects\Learningproject1\New Unity Project (1)\Assets\Scripts\IdleGame.cs 156 Active

I was curious about the message as I hadn’t seen it before and wondered if I could figure it out by looking at the code. However, you didn’t share all your code, so I don’t know the exact line numbers that match up with those errors.

My guess is you’re assigning values to local variables and then never using those variables, so the code doesn’t really understand the purpose. But, that is just a guess based on the message. And this is usually a warning and not an error.

I’m assuming you tried to Google the message already, so without sharing more of your code, I’m just throwing out what the message means.

This is the full code
This level mechanics seems like an important piece of coding I need to to understand efficiently so any help to understand it is going to going to benefit all my future coding…

using UnityEngine;
using UnityEngine.UI;

public class IdleGame : MonoBehaviour
{
    //ep 1
    public Text coinsText;
    public Text clickValueText;
    public double coins;
    public double coinsClickValue;

    //ep 2
    public Text coinsPerSecText;
    public Text clickUpgrade1Text;
    public Text clickUpgrade2Text;
    public Text productionUpgrade1Text;
    public Text productionUpgrade2Text;

    public double coinsPerSecond;
    public double clickUpgrade1Cost;
    public int clickUpgrade1Level;

    public double productionUpgrade1Cost;
    public int productionUpgrade1Level;

    //ep 3
    public double clickUpgrade2Cost;
    public int clickUpgrade2Level;

    public double productionUpgrade2Cost;
    public double productionUpgrade2Power;
    public int productionUpgrade2Level;


    //ep 6
    public Text gemsText;
    public Text gemBoostText;
    public Text gemsToGetText;

    public double gems;
    public double gemBoost;
    public double gemsToGet;

    public void Start()
    {
        Load();
    }

    public void Load()
    {
        coins = double.Parse(PlayerPrefs.GetString("Coins", "0"));
        coinsClickValue = double.Parse(PlayerPrefs.GetString("coinsClickValue", "1"));
        clickUpgrade1Cost = double.Parse(PlayerPrefs.GetString("clickUpgrade1Cost", "10"));
        clickUpgrade2Cost = double.Parse(PlayerPrefs.GetString("clickUpgrade2Cost", "100"));
        productionUpgrade1Cost = double.Parse(PlayerPrefs.GetString("productionUpgrade1Cost", "25"));
        productionUpgrade2Cost = double.Parse(PlayerPrefs.GetString("productionUpgrade2Cost", "250"));
        productionUpgrade2Power = double.Parse(PlayerPrefs.GetString("productionUpgrade2Power", "5"));

        productionUpgrade1Level = PlayerPrefs.GetInt("productionUpgrade1Level", 0);
        productionUpgrade2Level = PlayerPrefs.GetInt("productionUpgrade2Level", 0);
        clickUpgrade1Level = PlayerPrefs.GetInt("clickUpgrade1Level", 0);
        clickUpgrade2Level = PlayerPrefs.GetInt("clickUpgrade2Level", 0);

        gems = double.Parse(PlayerPrefs.GetString("gems", "0"));
    }

    public void Save()
    {
        PlayerPrefs.SetString("coins", coins.ToString());
        PlayerPrefs.SetString("coinsClickValue", coinsClickValue.ToString());
        PlayerPrefs.SetString("clickUpgrade1Cost", clickUpgrade1Cost.ToString());
        PlayerPrefs.SetString("clickUpgrade2Cost", clickUpgrade2Cost.ToString());
        PlayerPrefs.SetString("productionUpgrade1Cost", productionUpgrade1Cost.ToString());
        PlayerPrefs.SetString("productionUpgrade2Cost", productionUpgrade2Cost.ToString());
        PlayerPrefs.SetString("productionUpgrade2Power", productionUpgrade2Power.ToString());

        PlayerPrefs.SetInt("productionUpgrade1Level", productionUpgrade1Level);
        PlayerPrefs.SetInt("productionUpgrade2Level", productionUpgrade2Level);
        PlayerPrefs.SetInt("clickUpgrade1Level", clickUpgrade1Level);
        PlayerPrefs.SetInt("clickUpgrade2Level", clickUpgrade2Level);

        PlayerPrefs.SetString("gems", gems.ToString());
    }

    public void Update()
    {
        gemsToGet = (150 * System.Math.Sqrt(coins / 1e15));
        gemBoost = (gems + 0.01) + 1;

        gemsToGetText.text = "Prestige:\n+" + System.Math.Floor(gemsToGet).ToString("F0") + " Gems";
        gemsText.text = "Gems: " + System.Math.Floor(gems).ToString("F0");
        gemBoostText.text = gemBoost.ToString("F2") + "x boost";

        coinsPerSecond = (productionUpgrade1Level + (productionUpgrade2Power + productionUpgrade2Level)) + gemBoost;

        if (coinsClickValue > 1000)
        {
            var exponent = (System.Math.Floor(System.Math.Log10(System.Math.Abs(coinsClickValue))));
            var mantissa = (coinsClickValue / System.Math.Pow(10, exponent));
            clickValueText.text = "Click\n+" + mantissa.ToString("F0") + "e" + exponent + "Coins";
        }
        else
            clickValueText.text = "Click\n+" + coinsClickValue.ToString("F0") + "Coins";
        //clickValueText.text = "Click\n+" + coinsClickValue + " Coins";

        if (coins > 1000)
        {
            var exponent = (System.Math.Floor(System.Math.Log10(System.Math.Abs(coins))));
            var mantissa = (coins / System.Math.Pow(10, exponent));
            coinsText.text = "Coins: " + mantissa.ToString("F0") + "e" + exponent;
        }
        else
            coinsText.text = "Coins: " + coins.ToString("F0");
        //coinsText.text = "Coins: " + coins.ToString("F0");

        coinsPerSecText.text = coinsPerSecond.ToString("F0") + " coins/s";

        string clickUpgrade1CostString;
        if (coins > 1000)
        {
            var exponent = (System.Math.Floor(System.Math.Log10(System.Math.Abs(clickUpgrade1Cost))));
            var mantissa = (clickUpgrade1Cost / System.Math.Pow(10, exponent));
            clickUpgrade1CostString = mantissa.ToString("F2") + "e" + exponent;
        }
        else
            clickUpgrade1CostString = clickUpgrade1Cost.ToString("F0");

        string clickUpgrade1LevelString;
        if (clickUpgrade1Level > 1000)
        {
            var exponent = (System.Math.Floor(System.Math.Log10(System.Math.Abs(clickUpgrade1Level))));
            var mantissa = (clickUpgrade1Level / System.Math.Pow(10, exponent));
            clickUpgrade1LevelString = mantissa.ToString("F2") + "e" + exponent;
        }
            clickUpgrade1LevelString = clickUpgrade1Level.ToString("F0");
        //clickUpgrade1Text.text = "Click Upgrade 1\nCost: " + clickUpgrade1Cost.ToString("F0") + " coins\nPower: +1 click\nLevel: " + clickUpgrade1Level;
      
        string clickUpgrade2CostString;
        if (coins > 1000)
        {
            var exponent = (System.Math.Floor(System.Math.Log10(System.Math.Abs(clickUpgrade2Cost))));
            var mantissa = (clickUpgrade2Cost / System.Math.Pow(10, exponent));
            clickUpgrade1CostString = mantissa.ToString("F2") + "e" + exponent;
        }
        else
            clickUpgrade2CostString = clickUpgrade2Cost.ToString("F0");

        string clickUpgrade2LevelString;
        if (clickUpgrade1Level > 1000)
        {
            var exponent = (System.Math.Floor(System.Math.Log10(System.Math.Abs(clickUpgrade2Level))));
            var mantissa = (clickUpgrade2Level / System.Math.Pow(10, exponent));
            clickUpgrade1LevelString = mantissa.ToString("F2") + "e" + exponent;
        }
        else
            clickUpgrade2LevelString = clickUpgrade2Level.ToString("F0");
        //clickUpgrade1Text.text = "Click Upgrade 1\nCost: " + clickUpgrade1Cost.ToString("F0") + " coins\nPower: +1 click\nLevel: " + clickUpgrade1Level;

        productionUpgrade1Text.text = "Production Uprgrade 1\nCost: " + productionUpgrade1Cost.ToString("F0") + " coins\nPower: +" + gemBoost.ToString("F2") + " coins/s\nLevel: " + productionUpgrade1Level;
        productionUpgrade2Text.text = "Production Uprgrade 2\nCost: " + productionUpgrade2Cost.ToString("F0") + " coins\nPower: +" + (productionUpgrade2Power * gemBoost).ToString("F2") + " coins/s\nLevel" + productionUpgrade2Level;


        coins += coinsPerSecond * Time.deltaTime;

        Save();
    }

    // Prestige
    public void Prestige()
    {
        if (coins > 1000)
        {
            coins = 0;
            coinsClickValue = 1;
            clickUpgrade1Cost = 10;
            clickUpgrade2Cost = 100;
            productionUpgrade1Cost = 25;
            productionUpgrade2Cost = 250;
            productionUpgrade2Power = 5;

            productionUpgrade1Level = 0;
            productionUpgrade2Level = 0;
            clickUpgrade1Level = 0;
            clickUpgrade2Level = 0;

            gems += gemsToGet;
        }
    }
    // Butons
    public void Click()
    {
        coins += coinsClickValue;
    }

    public void BuyClickUpgrade1()
    {
        if (coins >= clickUpgrade1Cost)
        {
            clickUpgrade1Level++;
            coins -= clickUpgrade1Cost;
            clickUpgrade1Cost *= 1.07;
            coinsClickValue++;
        }
    }

    public void BuyClickUpgrade2()
    {
        if (coins >= clickUpgrade2Cost)
        {
            clickUpgrade2Level++;
            coins -= clickUpgrade2Cost;
            clickUpgrade1Cost *= 1.09;
            coinsClickValue += 5;
        }
    }


    public void BuyProductionUpgrade1Cost()
    {
        if (coins >= productionUpgrade1Cost)
        {
            productionUpgrade1Level++;
            coins -= productionUpgrade1Cost;
            productionUpgrade1Cost *= 1.07;
        }
    }

    public void BuyProductionUpgrade2Cost()
    {
        if (coins >= productionUpgrade2Cost)
        {
            productionUpgrade2Level++;
            coins -= productionUpgrade2Cost;
            productionUpgrade2Cost *= 1.07;
        }
    }
}

So, as I mentioned, I’m exactly correct it my response. Here is a screenshot of your code where I had the browser highlight every instance of the word clickUpgrade1CostString

This is it. You create a local variable (or method variable as some refer it), you assign values to it, but then you do absolutely nothing with that string. You never once use it anywhere else. What is the point of this string? So, the messages are telling you exactly that. Each time Update runs, you make a string, assign it a value, and then do nothing with it. When Update ends, that variable is lost.

The message is a way to alert you to this in case you meant to do something with it, or you can remove it to save resources.

Thank you for your reply. I realised I have to learn how this piece of code works.
Originally as you can see by the //text it was assigned to managing the majority of the click upgrade functions I require & via the tutorial the new code was to add scientific notation, so the code got more complex. I’m not certain but I think the purpose of casting it to a string was because of using doubles. Te reference string you mention I think is specifically for working with reducing the number to 2 decimal places of the scientific notation.
The problem I have is I have a button for click upgrade 1 & 2 that displays the cost, power & level but the level never seems to visually advance while I can see/calculate the amount is advancing… At 1 point in my adjusting the code the click upgrade 2 was advancing the click upgrade 1 level visually but not advancing the click upgrade 2 level visually.I readjusted this piece of code & now I have what we can see here but neither level on the button advances visually while I can see/calculate amount is advancing.
Actually none of the click upgrade button values are advancing visually now I notice it more completely. I assigned the scene object text (I hope that is a sufficient way of saying it as I’m very new (The scene cubes)) to the game manger text field.
I kinda understand your point & that my problem seems to be a separate problem. What I fail to do is to reconcile my separate problem as this referenced problem thus solving both problems…or…I am failing to understand how both problems are related. My fault not yours ofc. The reference of code doesn’t have a “power” assignment either that I can see.
The tutorial said for us to copy & adjust it as required without actually providing a visual example of the completed code. I might have to trawl the next classes to find completed examples but I decided to ask here because I feel this is a significant piece of code I require to understand first if I 'm going to gain any proficiency in coding later.
Also. There will be a player file somewhere for my Unity instance Unity is running. Can I delete it without major consequence? I just want to reset the instance & start at the beginning level but I don’t know how to do that in the Unity window.

I apologize for how confusing I explain things. I have a mental disability & I have had a lifetime to think about code without any coding experience. I taught myself all this without any books or external assistance or looking at any code but because of my mental disability it simple basic fundamentals I don’t retain stably. The age old problem of getting so fancy I can’t do the basic things…which is also why I decided to start coding now to get a foundation before the new webgl change. I understand code is just basic english. :slight_smile:
In my mind I have a theoretical reality I maintain I can theoretically pay with theoretical money I have theoretically made theoretically someone I have theoretically taught or theoretical employed “to do this”…theoretically damn entertaining…but theoretically entertaining others is theoretically achieving a critical mass wherein I want to entertain others literally.
I can’t pay for this assistance service but I hope my theoretical story is entertaining as theoretical bartering payment :slight_smile:
~ Theodore Esquire ‘EL BARTO’

Typically you’ll want to get the tutorial working first, without making any changes. Have you done this? Please provide a link to the tutorial you are doing that includes this code. If a video, please show the minutes into the video.

Remember you will NEVER learn how an entire system works all at once. We human beings learn one thing at a time, and build upon each previously-learned thing. If you’re like me, you also forget things you learned before and you have to review. I review stuff all the time when I’m working, and the more I review, the better I know something. It’s always a process, never a final result.

This is embodied in Step #2 below:

Tutorials and example code are great, but keep this in mind to maximize your success and minimize your frustration:

How to do tutorials properly, two (2) simple steps to success:

Tutorials are a GREAT idea. Tutorials should be used this way:

Step 1. Follow the tutorial and do every single step of the tutorial 100% precisely the way it is shown. Even the slightest deviation (even a single character!) generally ends in disaster. That’s how software engineering works. Every step must be taken, every single letter must be spelled, capitalized, punctuated and spaced (or not spaced) properly, literally NOTHING can be omitted or skipped.

Fortunately this is the easiest part to get right: Be a robot. Don’t make any mistakes.
BE PERFECT IN EVERYTHING YOU DO HERE!!

If you get any errors, learn how to read the error code and fix your error. Google is your friend here. Do NOT continue until you fix your error. Your error will probably be somewhere near the parenthesis numbers (line and character position) in the file. It is almost CERTAINLY your typo causing the error, so look again and fix it.

Step 2. Go back and work through every part of the tutorial again, and this time explain it to your doggie. See how I am doing that in my avatar picture? If you have no dog, explain it to your house plant. If you are unable to explain any part of it, STOP. DO NOT PROCEED. Now go learn how that part works. Read the documentation on the functions involved. Go back to the tutorial and try to figure out WHY they did that. This is the part that takes a LOT of time when you are new. It might take days or weeks to work through a single 5-minute tutorial. Stick with it. You will learn.

Step 2 is the part everybody seems to miss. Without Step 2 you are simply a code-typing monkey and outside of the specific tutorial you did, you will be completely lost. If you want to learn, you MUST do Step 2.

Of course, all this presupposes no errors in the tutorial. For certain tutorial makers (like Unity, Brackeys, Imphenzia, Sebastian Lague) this is usually the case. For some other less-well-known content creators, this is less true. Read the comments on the video: did anyone have issues like you did? If there’s an error, you will NEVER be the first guy to find it.

Beyond that, Step 3, 4, 5 and 6 become easy because you already understand!

Rl got busy, soz for delayed reply
I went back & looked at the tutorial video

7:37min for finished code … I made a few mistakes. I didn’t require to put the line of code that handles the cost power & level in //
I have no more messages in the editor window now.
I adjusted the code to this:

        string clickUpgrade1CostString;
        if (coins > 1000)
        {
            var exponent = (System.Math.Floor(System.Math.Log10(System.Math.Abs(clickUpgrade1Cost))));
            var mantissa = (clickUpgrade1Cost / System.Math.Pow(10, exponent));
            clickUpgrade1CostString = mantissa.ToString("F2") + "e" + exponent;
        }
        else
            clickUpgrade1CostString = clickUpgrade1Cost.ToString("F0");

        string clickUpgrade1LevelString;
        if (clickUpgrade1Level > 1000)
        {
            var exponent = (System.Math.Floor(System.Math.Log10(System.Math.Abs(clickUpgrade1Level))));
            var mantissa = (clickUpgrade1Level / System.Math.Pow(10, exponent));
            clickUpgrade1LevelString = mantissa.ToString("F2") + "e" + exponent;
        }
        else
            clickUpgrade1LevelString = clickUpgrade1Level.ToString("F0");
             
        /* string clickUpgrade2CostString;
        if (coins > 1000)
        {
            var exponent = (System.Math.Floor(System.Math.Log10(System.Math.Abs(clickUpgrade2Cost))));
            var mantissa = (clickUpgrade2Cost / System.Math.Pow(10, exponent));
            clickUpgrade2CostString = mantissa.ToString("F2") + "e" + exponent;
        }
        else
            clickUpgrade2CostString = clickUpgrade2Cost.ToString("F0");

        string clickUpgrade2LevelString;
        if (clickUpgrade1Level > 1000)
        {
            var exponent = (System.Math.Floor(System.Math.Log10(System.Math.Abs(clickUpgrade2Level))));
            var mantissa = (clickUpgrade2Level / System.Math.Pow(10, exponent));
            clickUpgrade2LevelString = mantissa.ToString("F2") + "e" + exponent;
        }
        else     
            clickUpgrade2LevelString = clickUpgrade2Level.ToString("F0");
        */

        clickUpgrade1Text.text = "Click Upgrade 1\nCost: " + clickUpgrade1CostString + " coins\nPower: +1 click\nLevel: " + clickUpgrade1LevelString;

        clickUpgrade2Text.text = "Click Upgrade 2\nCost: " + clickUpgrade2Cost.ToString("F0") + " coins\nPower: +1 click\nLevel: " + clickUpgrade2Level;

When I click on the Upgrade 2 button in the Unity game window it still performs the click on the on the Upgrade 1 button & visually updates the Upgrade 1 button instead of the Upgrade 2 button. Clicking on the Upgrade 1 updates the Upgrade 1 button as it should.
The Ui Object List has the Upgrade Objects correspondingly with the ClickUpgrade1/2 as the parent & the child object labeled: Text
I’ve dragged the “Text” objects into the corresponding game manager fields.
I skipped the buttons at the start of the tutorial so I am catching up. Not a smart choice I know. Now I have problems I thought I might have. I’ve watched the entire tutorial series up to this point a couple times & there isn’t much to do with the buttons so there isn’t much I can miss.

You must find a way to get the information you need in order to reason about what the problem is.

What is often happening in these cases is one of the following:

  • the code you think is executing is not actually executing at all
  • the code is executing far EARLIER or LATER than you think
  • the code is executing far LESS OFTEN than you think
  • the code is executing far MORE OFTEN than you think
  • the code is executing on another GameObject than you think it is
  • you’re getting an error or warning and you haven’t noticed it in the console window

To help gain more insight into your problem, I recommend liberally sprinkling Debug.Log() statements through your code to display information in realtime.

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 order does it run in?
  • what are the values of the variables involved? Are they initialized? Are the values reasonable?
  • are you meeting ALL the requirements to receive callbacks such as triggers / colliders (review the documentation)

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

If your problem would benefit from in-scene or in-game visualization, Debug.DrawRay() or Debug.DrawLine() can help you visualize things like rays (used in raycasting) or distances.

You can also call Debug.Break() to pause the Editor when certain interesting pieces of code run, and then study the scene manually, looking for all the parts, where they are, what scripts are on them, etc.

You can also call GameObject.CreatePrimitive() to emplace debug-marker-ish objects in the scene at runtime.

You could also just display various important quantities in UI Text elements to watch them change as you play the game.

If you are running a mobile device you can also view the console output. Google for how on your particular mobile target.

Another useful approach is to temporarily strip out everything besides what is necessary to prove your issue. This can simplify and isolate compounding effects of other items in your scene or prefab.

Here’s an example of putting in a laser-focused Debug.Log() and how that can save you a TON of time wallowing around speculating what might be going wrong:

https://discussions.unity.com/t/839300/3