cancel
Showing results for 
Search instead for 
Did you mean: 

OVR screen fade Does Not fade out.

Nickdreamdev
Level 3
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 7

GEMISIS
Level 6
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.

Nickdreamdev
Level 3

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:

Sixer
Level 2
Hi Gemisis, which object should this script live on?

GEMISIS
Level 6
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.

huiyun_chen
Level 2
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. s0c0bxlhb7w6.png

huiyun_chen
Level 2


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. s0c0bxlhb7w6.pngAlso, the controller cannot work. I can't walk or run or climb in unity with playercontroller. All it can do is show himself. 

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