Hello! To see if they can help me because they never answer my questions !!!
Well, what I need to do is to change the language of this code that I enter in the language of “Javascript” since at the moment I only specialize in that code.
Hope someone can help me…
using UnityEngine;
public class TEST: MonoBehaviour {
void OnGUI() {
GUILayout.Label("Score: " + score.ToString());
GUILayout.Label("Best Score: " + bestScore.ToString());
}
public int score {
get;
private set;
}
public int bestScore {
get;
private set;
}
private Vector3 startPosition;
void Awake() {
startPosition = transform.position;
bestScore = bestScore;
}
void Update() {
score = Mathf.RoundToInt(Mathf.Abs(transform.position.x - startPosition.x));
bestScore = Mathf.Max(score, bestScore);
}
public void OnGameOver() {
transform.position = startPosition;
}
}