I am playing with Unity’s Catch Game tutorial, and trying to add an object that would extend time when picked up. I added a timer like this in fixed update:
void FixedUpdate(){
if (playing) {
timeLeft -= Time.deltaTime;
if (timeLeft < 0) {
timeLeft = 0;
}
UpdateText ();
}
}
and then i did this:
void OnCollisionEnter2D(Collision2D collision){
if (collision.gameObject.tag == "timer") {
timeLeft += 10;
}
}
I also tried with void Update(), but id did not work. Thanks in advance.