-6

I am making a game in unity, where i will make a time system. But im getting this error "(42,18): error CS1525: Unexpected symbol (', expecting,', ;', or='" and i can not find out why i doesnt want work.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class TimeManager : MonoBehaviour {

public int seconds = 0;
public int minutes = 0;
public int hours = 0;
public int days = 0;
public int year = 0;
public Text TotalTimePlayed;

void Start(){
    StartCoroutine(time());
}

void Update(){
    TotalTimePlayed = year + " Y" + days + " D" + hours + " H" + minutes + " M" + seconds + " S";
}

private void timeAdd(){
    seconds += 1;
    if(seconds >= 60){
        minutes = 1;
    }

    if(minutes >= 60){
        hours = 1;
    }

    if(hours >= 24){
        days = 1;
    }

    if(days >= 365){
        year = 1;
    }

    IEnumerator time(){
        while (true){
            timeAdd();
            yield return new WaitForSendons(1);
        }
    }
}
}

What would work better/at all? Right now im getting the error "(42,18): error CS1525: Unexpected symbol (', expecting,', ;', or='"

Thanks for your help.

Ruzihm
  • 19,749
  • 5
  • 36
  • 48
dont know
  • 11
  • 1
  • 2

2 Answers2

0

There is one unnecessary } at the end of your file. Simply remove it!

Michael
  • 120
  • 9
0
IEnumerator time(){
    while (true){
        timeAdd();
        yield return new WaitForSendons(1);
    }
}

Take this "time()"function out from "timeAdd()"

Santosh
  • 278
  • 2
  • 11