02-06-2016 09:41 PM - edited 04-29-2021 02:24 PM
0
02-07-2016 01:24 AM
02-07-2016 12:06 PM
public void StartFade()
{
StartCoroutine(FadeOut());
}
/// <summary>
/// Fades alpha from 0.0 to 1.0
/// </summary>
IEnumerator FadeOut()
{
float elapsedTime = 0.0f;
fadeMaterial.color = fadeColor;
Color color = fadeColor;
isFading = true;
while (elapsedTime < fadeTime)
{
yield return fadeInstruction;
elapsedTime += Time.deltaTime;
color.a = Mathf.Clamp01(elapsedTime / fadeTime);
fadeMaterial.color = color;
}
isFading = false;
}
03-02-2016 10:54 AM
03-02-2016 01:47 PM
IEnumerator FadeOut()
{
float elapsedTime = 0.0f;
Color color = fadeColor;
color.a = 0f;
fadeMaterial.color = color;
isFading = true;
while (elapsedTime < fadeTime)
{
yield return fadeInstruction;
elapsedTime += Time.deltaTime;
color.a = Mathf.Clamp01(elapsedTime / fadeTime);
fadeMaterial.color = color;
}
isFading = false;
}
03-02-2016 04:15 PM
03-03-2016 08:35 AM
"treytech" wrote:
Try this (untested by me):
IEnumerator FadeOut()
{
float elapsedTime = 0.0f;
Color color = fadeColor;
color.a = 0f;
fadeMaterial.color = color;
isFading = true;
while (elapsedTime < fadeTime)
{
yield return fadeInstruction;
elapsedTime += Time.deltaTime;
color.a = Mathf.Clamp01(elapsedTime / fadeTime);
fadeMaterial.color = color;
}
isFading = false;
}
10-27-2018 04:14 PM
10-29-2018 07:48 AM
HannahTS95 said:
Is there a more recent solution to this problem? These answers don't seem to be compatible with OVRScreenFade anymore! Thank you!
/// <summary>
/// Start a fade out
/// </summary>
public void FadeOut()
{
StartCoroutine(Fade(0,1));
}
10-30-2018 06:19 AM