Quantcast
Channel: Questions in topic: "error message"
Viewing all articles
Browse latest Browse all 2891

[C#] implicit convert error

$
0
0
Hello, I am getting the error "Assets/Scripts/Upgrades.cs(20,17): error CS0029: Cannot implicitly convert type 'string' to 'UnityEngine.UI.Text'". The corresponding script is the following: using UnityEngine; using UnityEngine.UI; using System.Collections; public class Upgrades : MonoBehaviour { public ClickScript click; public Text itemInfo; public float cost; public int count = 0; public int clickPower; public string itemName; private float baseCost; void Start(){ baseCost = cost; } void Update(){ itemInfo = itemName + "\nCost: " + cost + "\nPower: +" + clickPower; } public void PurchasedUpgrade(){ if (click.Money >= cost) { click.Money -= cost; count++; click.MoneyPerClick += clickPower; cost = baseCost * Mathf.Pow(1.30f, count); } } }

Viewing all articles
Browse latest Browse all 2891

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>