private IEnumerator RegisterWhenReady() { while (!GetComponentInParent <Canvas>().worldCamera) { yield return(null); } Camera c = GetComponentInParent <Canvas>().worldCamera; Image i = GetComponent <Image>(); FadeManager.RegisterFadeImage(c, i); i.color = Color.black; if (UnfadeOnStart) { FadeManager.BeginFadeFromColor(c, 1); } }
private IEnumerator InitializeHUD() { yield return(null); PlayerHUD.GetComponent <Canvas>().worldCamera = Camera; PlayerHUD.GetComponent <Canvas>().planeDistance = 0.1f; if (!SplitScreenManager.Instance.Is3D && SortingLayer.IsValid(SortingLayer.NameToID("Foreground"))) { PlayerHUD.GetComponent <Canvas>().sortingLayerName = "Foreground"; } else if (!SplitScreenManager.Instance.Is3D) { Debug.LogWarning("'Foreground' layer wasn't found. Please read the README and create sorting layers called Foreground and Background."); } PlayerHUD.GetComponent <Canvas>().sortingOrder = SplitScreenManager.PLAYER_HUD_LAYER_ORDER; yield return(null); FadeManager.BeginFadeFromColor(Camera, 1); }