How to make upgrade multiplier for clicker game

Hello community I am making a clicker game but I don’t know how to do the upgrade multiplier button such as Adventure Capitalist, I have a single script attached to each GameObject, total of six objects with the same script attached, where I have the Text object which shows a double value which is an array with six indexes, the problem here is that I have the multiplier button object attached with another script, I should do something as static (singleton) because each script has many objects, I only need to access to a single text which is upgrade price displayer crop which is non-static. Pls help me.

6136905--669459--164127-캡처.png
6136905--669462--164128-캡처2.png

Show the upgrade script so we know what your working with

Hello speedy the code is, for upgrade

public class MultiplyManager : MonoBehaviour
{
    public bool multiplier_Crop;

    public void multiply_Crop_PerOne()
    {
        UpgradeButtonCrop.multiplier = 1;
    }
    public void multiply_Crop_PerTen()
    {
        UpgradeButtonCrop.multiplier = 10;
    }
    public void multiply_Crop_PerHundred()
    {
        UpgradeButtonCrop.multiplier = 50;
    }
}

And for text object

 public static int multiplier = 1;

upgrade_price_displayer_crop.text = LargeNumber.ToString(crop_upgrade_price_arr[index]).ToString();

public void First_Crop_Button()
    {
        purchaseUpgradeCrop(0);
    }
    public void Second_Crop_Button()
    {
        purchaseUpgradeCrop(1);
    }
    public void Third_Crop_Button()
    {
        purchaseUpgradeCrop(2);
    }
    public void Fourth_Crop_Button()
    {
        purchaseUpgradeCrop(3);
    }
    public void Fifth_Crop_Button()
    {
        purchaseUpgradeCrop(4);
    }
    public void Last_Crop_Button()
    {
        purchaseUpgradeCrop(5);
    }
    public void purchaseUpgradeCrop(int index)
    {
        if ((level_crop_arr[index] + multiplier) <= max_level)
        {
                if (DataController.Instance.gold >= crop_upgrade_price_arr[index] * multiplier)
                {
                updateUI_Crop(index);
                updateUpgrade_Crop();
                    //updateUI_Crop();
                DataController.Instance.saveUpgradeButton_Crop(this);
                }
            }
        else
        {
            UpgradeMessageManager.instance.Start_coroutine_cant_upgrade();
            return;
        }
    }
  • public class MultiplyManager : MonoBehaviour

    • {
  • public bool multiplier_Crop;

    • public void multiply_Crop_PerOne()
  • {

  • UpgradeButtonCrop.multiplier =+ 1;

  • }

  • public void multiply_Crop_PerTen()

  • {

  • UpgradeButtonCrop.multiplier =+ 10;

  • }

  • public void multiply_Crop_PerHundred()

  • {

  • UpgradeButtonCrop.multiplier =+ 50;

  • }

  • }

I tried to put it in code format but Dont know how haha

haha thanks for reply, the main problem that I am having is I need to show the multiplied price of the upgrade, so to do that I need to use a static function from the upgrade class, but the text object is non-static and to do that I should need change all of my code to static field, what could be the best way to do this? Update function just doesn’t work with this coz the price need to be upgraded for each click and shown again.

have u got
using unity.text.ui;
?

This might help you mate :slight_smile: GitHub - pikacsc/Unity_CookieClicker: This simple clicker game is created with UnityEngine.

yes, sorry buddy, what I want to do is a upgrade multiplier
for example total of 30 levels of an upgrade, if you click the button Buy, it shows x1, x10,
if an upgrade costs 1, and you multiply it for 10 it will cost 10 and the level of the upgrade will increase 10 levels.

OHHHHH I get u know

Yea I am not to sure how todo that. Maby try this one https://github.com/b2jammer/incremental-game if this does not work I have hit the same brick wall u have

sure thanks