I’m trying to add a score system to my game. Now like last the code work, surprisingly. Except again, its not how i want it to. Now i looked through the unity documentation for timers but it didnt have anything that seemed related to this which i probably did miss something. I used the same code for my Enenmy Spawn which had the timer thing. But Im also using delta time which i think is the problem which delta time i think uses fps if im not wrong. So is there any way to make increase time every second.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class ScoreSystem : MonoBehaviour
{
public float timer;
public float scoreRate;
public Text scoreText;
public int score;
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
if (timer < scoreRate)
{
timer = timer + Time.deltaTime;
}
else
{
score = score + 1;
scoreText.text = score.ToString();
}
}
}
heres the scoresytem if i need to do something here: