New to Unity and trying to do my own code, but I stuffed up. I was trying to add a score to text when the jump was pressed but all I got was one’s felling the whole screen whenever the jump key was pressed. How do I get the score to add whenever I use Jump?
using UnityEngine;
using UnityEngine.UI;
public class Score : MonoBehaviour
{
public Transform player;
public Text scoreText;
// Update is called once per frame
void Update()
{
if (Input.GetButtonDown("Jump"))
scoreText.text = ("1");
}
}