Answer the question
In order to leave comments, you need to log in
How to fix this? unity 2019.2.10f1?
In short, such an error: the
English version of the error:
error CS0201: Only assignment, call, increment, decrement, await, and new object expressions can be used as a statement
Ошибка CS0201: в качестве оператора могут использоваться только выражения присваивания, вызова, приращения, уменьшения, ожидания и новых объектов
using UnityEngine;
using UnityEngine.UI;
public class game : MonoBehaviour
{
public Text scoreText;
public GameObject shopPan;
private int score;
private int bonus = 1;
public int[] shopCosts;
public int[] shopBonuses;
public Text[] shopBttnsText;
public void shopPan_ShowAndHide()
{
shopPan.SetActive(!shopPan.activeSelf);
}
public void shopBttn_addBonus(int index)
{
if (score >= shopCosts[index])
{
bonus += shopBonuses[index];
score -= shopCosts[index];
shopCosts[index] *= 2;
shopBttnsText[index].text = "BUY UPGRADE \n"; + shopCosts[index] + "$" ;
}
else
{
Debug.Log("Not enought money");
}
}
public void onClick()
{
score += bonus;
scoreText.text = score + "$";
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question