This appears like it would be easy but it is racking my brain. What I am trying to do is use the skybox blender shader to transition between two different skyboxes. This I have working correctly. I have the skyboxes successfully transition when the float blend goes from 0 to 1. But I am having trouble with getting the float to, after it completes this initial transition, to then lerp back from 1 to 0. Here is an example of the script:
public class DayNight : MonoBehaviour {
public float blend;
public Color daycolor = new Color (0.95f, 0.66f, 0.4f, 1.0f);
public Color32 nightcolor = new Color (0.13f, 0.26f, 0.44f, 1.0f);
void Start ()
{
RenderSettings.ambientLight = daycolor;
}
void Update ()
{
blend = Mathf.Lerp(0, 1, Time.time*.05f);
RenderSettings.skybox.SetFloat("_Blend", blend);
RenderSettings.ambientLight = Color.Lerp (daycolor, nightcolor , Time.time*.05f);
}
}
How do you use, or can you use, Mathf.PingPong to ping pong between float values? All I ever see is it using a vector3.
Thanks