#Subtract the interval rather than

1 messages · Page 1 of 1 (latest)

limpid condor
#

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

cyan patio
#

Also whatever you want to do every 4 seconds goes inside that if

limpid condor
#

that was a lot easier of a fix

cyan patio
#

Not some arbitrary number like 0.1

limpid condor
#

wdym

cyan patio
#

If you want the timer to be accurate

limpid condor
#

yeah i know that but like

#

Timer += Time.deltaTime

#

?

cyan patio
#

Yes

limpid condor
#

do i need to change the if statement

cyan patio
#

No why would you

limpid condor
#

cause idk how timers work lol

#

it says float doesnt contain a definition for deltatime

cyan patio
#

Sounds like you wrote Timer.deltaTime instead of Time.deltaTime

limpid condor
#

sigh

#

u were right once again