(need help with error) The type or namespace name "BigDouble" could not be found (are you missing a using directive or an assembly reference ?)

Im new to this and am trying to create an idle game following a youtube tutorial

this certain episode he went all over the place and i kind of got stuck. Im getting the error mentioned in the title here is the code if you can help it would mean a lot.

Controller.cs

using UnityEngine;
using TMPro;

public class Controller : MonoBehaviour
{
    public UpgradeManager upgradeManager;
    public Data data;

    public TMP_Text GramText;

    [SerializeField] private TMP_Text gramClickPowerText;

    public BigDouble ClickPower()
    {
        return 1 + data.clickUpgradeLevel;
    }

    public void Start()
    {
        data = new Data();
        upgradeManager.StartUpgradeManager();

    }

    public void Update()
    {
        GramText.text = data.Gram + " Gram";
        gramClickPowerText.text = "+" + ClickPower() + " Gram Per Click";
    }

    public void GenerateDollars()
    {
        data.Gram += ClickPower();
    }

}

Data

using UnityEngine;

public class Data
{
    public double Gram;

    public BigDouble clickUpgradeLevel;


    public Data()
    {
        Gram = 0;
        clickUpgradeLevel = 0;
    }
}

UpgradeManager.cs

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

public class UpgradeManager : MonoBehaviour
{
    public Controller controller;
    public Data data;

    public Upgrades clickUpgrade;

    public string ClickUpgradeName;

    public BigDouble clickUpgradeBaseCost;
    public BigDouble clickUpgradeCostMult;

    public void startUpgradeManager()
        {
        clickUpgradeName = "Gram Per Click";
        clickUpgradeBaseCost = 10;
        clickUpgradeCostMult = 1.5;
        UpdateClickUpgradeUI();
}

    public void UpdateClickUpgradeUI()
    {
        clickUpgrade.LevelText.text = controller.data.clickUpgradeLevel.ToString();
        clickUpgrade.CostText.text = "Cost: " + cost() + " Gram";
        clickUpgrade.NameText.text = "+1 " + clickUpgradeName;
    }

public BigDouble cost() 
{
    return clickUpgradeBaseCost * BigDouble.Pow( clickUpgradeCostMult, controller.data.clickUpgradeLevel);
}

    public void BuyUpgrade()
    {
        if (controller.data.gram > cost())
        {
            controller.data.gram -= cost();
            controller.data.clickUpgradeLevel += 1;
        }
        UpdateClickUpgradeUI();
    }
    
}

Hey @SilverV4,

BigDouble does not exist in c#. It seems like the creator of the video has external packages installed.

Few solutions;

  • Change BigDouble to Double

  • Find an import that has a BigDouble implementation

Personally, I’d just go with using Double :slight_smile:

Hope that helps!


Edited -
Looking back at the video that you’ve posted, we can see that in his Scripts folder, the BigDouble class already exists meaning that it’s pre-created.

Scrolling to this video in the playlist:

We can see the definition for BigDouble.

If following a tutorial, please start from the beginning of the series to not miss items as these.