So I’m trying to create a score system that goes up by 100 every second. I get this error:
“Only assignment, call, increment, decrement, and new object expressions can be used as a statement”
This is my code so far:
using UnityEngine;
using System.Collections;
public class ScoreperSec : MonoBehaviour {
public int startingScore = 0;
public int currentScore = 0;
public GUIText scoregui;
private float time;
private int score;
void Update (){
time+=Time.deltaTime;
//currentScore += (int)time;
print ((int)time);
(int)time * 100 == score;
scoregui.text = "Score: "+ score;
}
}
Is it this statement?
(int)time * 100 == score;
== is a comparison and doesn’t make any sense in this context. If you meant = then the left hand side is not a variable (lvalue).