void Update() { transform.Rotate(0, 0, speed * Time.deltaTime); float z = gameObject.transform.rotation.eulerAngles.z; Debug.Log(z); if (z > 270f && z < 360f || z < 90f && z > 0f) { day = true; } else if (z > 90f && z < 270f) { day = false; } if (day) { Debug.Log("DAY"); if (!switched) { switched = true; groundController.Day(); goldController.Day(); } } else { Debug.Log("NIGHT"); if (switched) { switched = false; groundController.Night(); goldController.Night(); } } }