I just can’t see what’s wrong with this script and any other script I used Time.deltatime in. It gives me the same error every time even though I have no variable, script or anything else named time that could conflict with Time.deltatime. using UnityEngine is present . I just can’t figure out this issue and I have looked everywhere. I even followed a tutorial on my issue and it still gives me the same problem. ` using UnityEngine;
using System.Collections;
using System;
using UnityEngine.UI;
public class DayNightCycle : MonoBehaviour
{
public float daytime;
public TimeSpan currenttime;
public Transform sunpos;
public Light sun;
public Text timetext;
public int days;
public float intensity;
public Color fogday = Color.grey;
public Color fognight = Color.black;
public int speed;
// Use this for initialization
void Start()
{
}
// Update is called once per frame
void Update()
{
}
void ChangeTime()
{
daytime += Time.deltatime * speed;
if (daytime > 86400)
{
days += 1;
daytime = 0;
}
currenttime = TimeSpan.FromSeconds(daytime);
string[] temptime = currenttime.ToString().Split(":"[0]);
timetext.text = temptime[0] + ":" + temptime[1];
sunpos.rotation = Quaternion.Euler(new Vector3 ((daytime - 21600) / 86400 * 360, 0, 0));
if (daytime < 43200)
{
intensity = 1 - (43200 - daytime) / 43200;
}
else
{
intensity = 1 - (43200 - daytime) / 43200 * -1;
}
sun.Intensity = intensity;
}
}