i'm getting an error that implies that i'm trying to convert a string to int. But there are no strings inside of my code. Can anyone help me?
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class Timer : MonoBehaviour
{
public static float timer = 1995f;
public static float month = 4f;
public static float day = 2f;
public static float hour = 10f;
public static float minute = 0f;
public static int IntYear;
public static int IntMonth;
public static int IntDay;
public static int IntHour;
public static int IntMinute;
public GameObject oldtime;
public GameObject badtime;
public GameObject goodtime;
public Text Clock;
public static int inttime;
public static float floattime;
void FixedUpdate()
{
timer += Time.fixedDeltaTime / 60 / 60 / 60 / 30 / 12;
month += Time.fixedDeltaTime / 60 / 60 / 24 / 30;
day += Time.fixedDeltaTime / 60 / 60 / 24;
hour += Time.fixedDeltaTime / 60;
minute += Time.fixedDeltaTime / 1;
IntYear = Mathf.FloorToInt(timer);
IntMonth = Mathf.FloorToInt(month);
IntDay = Mathf.FloorToInt(day);
IntHour = Mathf.FloorToInt(hour);
IntMinute = Mathf.FloorToInt(minute);
if (minute > 60)
{
minute = 0;
}
if (hour > 24)
{
minute = 0;
}
if (day > 30)
{
minute = 0;
}
if (month > 12)
{
minute = 0;
}
inttime = IntYear + "/" + IntMonth + "/" + IntDay + " " + IntHour + ":" + IntMinute;
floattime = timer + "/" + month + "/" + day + " " + hour + ":" + minute;
Clock.text = inttime.ToString();
}
}
↧