ScreenFader.SetAlpha C# (CSharp) Method

SetAlpha() private method

private SetAlpha ( float alpha ) : void
alpha float
return void
    private void SetAlpha(float alpha)
    {
        if (faderMaterial != null)
        {
            Color colour = faderMaterial.color;
            colour.a = Mathf.Clamp01(alpha);
            faderMaterial.color = colour;
        }
    }

Usage Example

    void Awake()
    {
        if (Instance != this)
        {
            Destroy(gameObject);
            return;
        }

        DontDestroyOnLoad(gameObject);

        m_PlayerInput = FindObjectOfType <PlayerInput>();

        if (initialSceneTransitionDestination != null)
        {
            SetEnteringGameObjectLocation(initialSceneTransitionDestination);
            ScreenFader.SetAlpha(1f);
            StartCoroutine(ScreenFader.FadeSceneIn());
            initialSceneTransitionDestination.OnReachDestination.Invoke();
        }
        else
        {
            m_CurrentZoneScene          = SceneManager.GetActiveScene();
            m_ZoneRestartDestinationTag = SceneTransitionDestination.DestinationTag.A;
        }
    }
All Usage Examples Of ScreenFader::SetAlpha