public void AddMoney(float moneyToAdd) { if (!noCost) { money += moneyToAdd; uiManager.UpdateMoney(money); //dm.company.money = money; } }
void Start() { try { GameObject manager = GameObject.Find("DispensaryManager"); dm = manager.GetComponent <DispensaryManager>(); uiManager = manager.GetComponent <UIManager_v1>(); uiManager.UpdateMoney(money); noCost = true; } catch (NullReferenceException) { } }