- Home /
Question by
Daimien · Feb 28, 2015 at 02:29 PM ·
script error
day night script errors
does anyone know what is wrong i keep getting errors on the private const I'm trying to make a day night cycle i got this script from someone on youtube and i keep getting errors
errors
Assets/SunTimeOfDay.cs(11,40): error CS0103: The name HOUR' does not exist in the current context Assets/SunTimeOfDay.cs(13,56): error CS0103: The name
DAY' does not exist in the current context
Assets/SunTimeOfDay.cs(10,41): error CS0103: The name `MINUTE' does not exist in the current context
using UnityEngine; using System.Collections;
public class SunTimeOfDay : MonoBehaviour { public Transform[] sun; public float dayCycleInMinutes = 1; private const float SECOND = 1; private const float Minute = 60 * SECOND; private const float Hour = 60 * MINUTE; private const float Day = 24 * HOUR; private const float DEGREES_PER_SECOND = 360 / DAY; private float _degreeRotation; private float _timeOfDay; // Use this for initialization void Start () { _timeOfDay = 0; _degreeRotation = DEGREES_PER_SECOND * Day / (dayCycleInMinutes * Minute); } // Update is called once per frame void Update () { sun [0].Rotate (new Vector3(_degreeRotation, 0, 0) * Time.deltaTime); _timeOfDay += Time.deltaTime; Debug.Log (_timeOfDay); } }
Comment
ok, thank you, i missed that. i did not put that in caps i thought it was something else.
Your answer
![](https://koobas.hobune.stream/wayback/20220613184607im_/https://answers.unity.com/themes/thub/images/avi.jpg)