- Home /
How can i change numbers by time
I have day and night circle script i added it somethings for example _fogColorController it changes color of fog but it happen suddenly so i want to change color slowly what should i add to the argb numbers (like this intensity changes)? thank u so much
if (controlIntensity && sunLight && (currentTime >= 18.0f || currentTime <= 5.5f))
{
sunLight.intensity =
Mathf.MoveTowards(sunLight.intensity,0.0f,Time.deltaTime*daySpeedMultiplier*10.0f); //Gece
_fogColorController._fogColorWater = new Color(0.04f, 0.04f, 0.1f, 0.5f);
}
else if (controlIntensity && sunLight)
{
sunLight.intensity = Mathf.MoveTowards(sunLight.intensity,1.0f,Time.deltaTime*daySpeedMultiplier*10.0f); //Gündüz
_fogColorController._fogColorWater = new Color(0.2f, 0.65f, 0.75f, 0.5f);
}
Answer by Astrydax · Sep 26, 2016 at 08:17 PM
Create variables called float red,green, blue = 0.0f; //or whatever starting values you need. Change these values as needed in update(). Something like: if red is not equal to the final target value then red+=5 * changeSpeed; . Then _fogColorController._fogColorWater = new Color(red,green, blue,0.5f);
Answer by Haider96 · Sep 26, 2016 at 05:42 PM
Public float currentTime;
Void Update () { currentTime += Time.deltaTime; // currentTime plus or minus Time.deltaTime }
Answer by dandelo99 · Sep 26, 2016 at 04:57 PM
i want to change my color slowly like intensity changes
Your answer
Follow this Question
Related Questions
Make something change color for a set amount of time 3 Answers
Jump with mathf.lerp problem 2 Answers
Math.Abs slows down on time.timescale 0 Answers
Changing color of texture with transparency efficiently 0 Answers