- Home /
Script doesnt work when changing value in GameMode, VR
Hey all, I have a script to change the Position of the Sun based on the real Time. Now i have Buttons to change the hour and minutes. When i start the Scene in GameMode, i can change the value of hour and minutes in the inspector manually and the Sun is changing his position. But using the Buttons only changes the values in the inspector but my Sun is not chaning his position :/ I have a Light GameObject with the Sun Script : with hour and minutes [SerializeField] [Range(0, 24)] public int hour;
[SerializeField]
[Range(0, 60)]
public int minutes;
full Script that i use is here https://gist.githubusercontent.com/paulhayes/54a7aa2ee3cccad4d37bb65977eb19e2/raw/96574ed9041f15902672b92ac7ef80268bbc27b8/Sun.cs
with an other Script i change the values like this:
if(name == "hour_up")
{
mysunpos.GetComponent<Entropedia.sunpos>().hour += 1;
}
if the ray hits the button hour_up it should increase the hour by one. Well it changes the value in the inspector but the sun pos doesnt change :/
i tried to disable the sun script to change the value, but when i enable it again it still doesnt change the sun position. Only when i use my mouse to enable it again in the inspector, then the sun is chaning his position ...
someone got an idea?
Your answer
![](https://koobas.hobune.stream/wayback/20220613002943im_/https://answers.unity.com/themes/thub/images/avi.jpg)