Hello there, I was trying to create a multiplier that increase, let’s say, of 1 unit after every 7 seconds. I written this code, but it doesn’t work. Any suggestion?
Thanks in advance.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using TMPro;
public class scoreHandelr : MonoBehaviour
{
[SerializeField] private TMP_Text scoreText;
private float score;
private int multiplier=1;
private float timer = 0f;
void Update()
{
timer +=Time.deltaTime;
if(timer%7==0)
{
multiplier +=1;
}
score +=Time.deltaTime*multiplier;
scoreText.text= Mathf.FloorToInt(score).ToString()+"\t"+"X"+multiplier.ToString();
}
}