Search Unity

Fade into scene in unity

Discussion in 'AR/VR (XR) Discussion' started by Patrk, Aug 6, 2019.

  1. Patrk

    Patrk

    Joined:
    Apr 9, 2017
    Posts:
    48
    Hi,

    I am using this code below for a gradual fade into a scene/next level in Unity/Steam VR (HTC Vive) The whole idea is to cover up the scene loading icon which is viewable for 3-4 seconds and the default Steam landscape scene. The fade (to red) works fine…BUT it comes in after the loading icon so this defeats the whole purpose of it. Is there any simple way to fix this?
    thanks


    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4.  
    5. public class NewFade : MonoBehaviour {
    6.  
    7.     private float _fadeDuration = 4f;
    8.  
    9.     private void Start()
    10.     {
    11.         FadeFromWhite();
    12.     }
    13.  
    14.     private void FadeFromWhite()
    15.     {
    16.         //set start color
    17.         SteamVR_Fade.View(Color.red, 0f);
    18.         //set and start fade to
    19.         SteamVR_Fade.View(Color.clear, _fadeDuration);
    20.     }
    21.