Forum Discussion

🚨 This forum is archived and read-only. To submit a forum post, please visit our new Developer Forum. 🚨
Nickdreamdev's avatar
Nickdreamdev
Explorer
9 years ago

OVR screen fade Does Not fade out.

I need help fading out the camera/ screen in VR  to a color.

I Have tried adding this Code from another forum post from a while a go and it still does not work, I have Also tried using other Screen fading scripts, They work in the game - view in unity, but not  in VR.


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;
}

7 Replies

  • We're using a custom version of the fade script that handles fading in and out, as well as callbacks for when fading is completed.  You'll need the Oculus included "Unlit Transparent Color" shader, but other than that it should be okay to use.  If there's an issue from any Oculus staff with me sharing this script, just let me know and I'll take it down, but otherwise you can feel free to use it from here.  Our code is basically the same as yours, so I'm not entirely sure why it wouldn't be working off the top of my head, so maybe give this a try to see if it fixes your issue.

  • GEMISIS said:

    We're using a custom version of the fade script that handles fading in and out, as well as callbacks for when fading is completed.  You'll need the Oculus included "Unlit Transparent Color" shader, but other than that it should be okay to use.  If there's an issue from any Oculus staff with me sharing this script, just let me know and I'll take it down, but otherwise you can feel free to use it from here.  Our code is basically the same as yours, so I'm not entirely sure why it wouldn't be working off the top of my head, so maybe give this a try to see if it fixes your issue.


    Thanks for this, I will try it tomorrow and tell you how it goes! :smiley:
  • Hi Gemisis, which object should this script live on?
  • This should live on your player's face (in our case, the Unity camera in the scene).  This is because it is essentially rendering a quad in front of the users face, with transparency enabled on it.
  • It looks like this now in the unity. Anyone can help me? I have been work on this issue for many days, I AM SO TIRED OF IT. 


  • It looks like this now in the unity. Anyone can help me? I have been work on this issue for many days, I AM SO TIRED OF IT. Also, the controller cannot work. I can't walk or run or climb in unity with playercontroller. All it can do is show himself. 

    • Branoj's avatar
      Branoj
      Honored Guest

      Were you able to fix it ? I am facing exact same issue.. THanks