#Subtract the interval rather than
1 messages · Page 1 of 1 (latest)
i'm probably doing this very wrong but it wont let me add and it also says "cannot convert lambda expression to type 'bool' because it is not a delegate type"
using System.Collections;
using UnityEngine;
using System.Threading;
using UnityEngine.UI;
public class game : MonoBehaviour
{
public Text cash;
public Text stand1price;
public Text stand1generate;
public Text stand1level;
public float Timer;
public void Increment()
{
PlayerPrefs.SetString("cash", GameManager.cash.ToString());
PlayerPrefs.SetString("stand1level", GameManager.stand1level.ToString());
}
void Start()
{
}
public void stand1()
{
if(Timer => 4f)
{
GameManager.cash += stand1generate;
PlayerPrefs.SetString("cash", GameManager.cash.ToString());
}
}
void Update()
{
stand1price.text = " " + GameManager.stand1price;
cash.text = " " + GameManager.cash;
stand1level.text = "Level: " + GameManager.stand1level;
Timer += 0.1f;
if(Timer => 4f)
{
Timer -= 4f;
}
}
}
wait nvm the add thign was cause i messed one part up but it still is saying stuff about the delegate type
= not =>
Also whatever you want to do every 4 seconds goes inside that if
that was a lot easier of a fix
And it should be timer += Time.deltaTime
Not some arbitrary number like 0.1
wdym
I mean this
If you want the timer to be accurate
Yes
do i need to change the if statement
No why would you
cause idk how timers work lol
it says float doesnt contain a definition for deltatime
Sounds like you wrote Timer.deltaTime instead of Time.deltaTime