Android Build freezes on startup
Hey everyone. I tried porting my mini game from pc to android. In the unity editor everything was going fine but the game just freezes the screen on startup on an actual device. I was wondering if the bug was coming from this script which is responsible for loading my custom splash screen and the main menu with SetAlpha:
 using System.Collections;
 using System.Collections.Generic;
 using UnityEngine;
 using UnityEngine.UI;
 using DiscordPresence;
 using TMPro;
 
 public class MenuAnimations : MonoBehaviour
 {
     public TextMeshProUGUI text1, text2;
     public Image noit;
     public GameObject quit, play, settings;
 
     public AudioSource MainMenu;
     public AudioClip keyboardClick, mainMenuMusic, sfx;
 
     public float textSpeed = 0.5f;
     public string fullText = "KINTER 2";
     private string currentText = "";
 
     public CanvasGroup mainMenuu;
 
     void Start()
     {
         PresenceManager.UpdatePresence(detail: "Main Menu",start: System.DateTimeOffset.Now.ToUnixTimeSeconds());
 
         MainMenu.clip = sfx;
         MainMenu.Play();
         text1.canvasRenderer.SetAlpha(0.0f);
         noit.canvasRenderer.SetAlpha(0.0f);
         FadeInLoading1();
         StartCoroutine(Wait());
     }
 
     void FadeInLoading1()
     {
         text1.CrossFadeAlpha(1, 2, false);
         noit.CrossFadeAlpha(1, 2, false);
     }
 
     void FadeOutLoading1()
     {
         text1.CrossFadeAlpha(0, 2, false);
         noit.CrossFadeAlpha(0, 2, false);
     }
 
     public IEnumerator Wait()
     {
         yield return new WaitForSeconds(3f);
         FadeOutLoading1();
         yield return new WaitForSeconds(3f);
         MainMenu.clip = keyboardClick;
 
         for (int i = 0; i <= fullText.Length; i++)
         {
             currentText = fullText.Substring(0, i);
             text2.text = currentText;
             if(i==fullText.Length)
             {
                 break;
             }
             MainMenu.Play();
             yield return new WaitForSeconds(textSpeed);
         }
 
         MainMenu.clip = mainMenuMusic;
         MainMenu.Play();
         yield return new WaitForSeconds(0.5f);
 
         quit.SetActive(true);
         play.SetActive(true);
         settings.SetActive(true);
         while(mainMenuu.alpha < 1)
         {
             mainMenuu.alpha += Time.deltaTime;
             yield return new WaitForSeconds(0.001f);
         }
     }
 }
 
Note: I know the code is too messy and very unoptimised but I made it a long time ago when I didn't know how to use Coroutines correctly.
Your answer
 
 
             Follow this Question
Related Questions
Unity 2017.2.0b9 ARCore build&run with Pixel XL (Android 8.0) Failed 0 Answers
Set-up Android SDK path to make Android remote work 0 Answers
CommandInvokationFailure: 1 Answer
My game are really smooth on Unity test but really really lagging after build on Android 0 Answers
Is there a way to setup Android environment and Android Sdk without unity hub!? 1 Answer
 koobas.hobune.stream
koobas.hobune.stream 
                       
               
 
			 
                