Skip to main content
February 21, 2017

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

GEMISIS
Inspiring
February 21, 2017
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.
February 21, 2017

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:
New Participant
March 8, 2017
Hi Gemisis, which object should this script live on?
GEMISIS
Inspiring
March 8, 2017
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.
New Participant
November 15, 2020
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. 
New Participant
November 15, 2020


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. 

New Participant
February 18, 2022

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