Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
12 Jun 22 - 14 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
1
Question by Jay1234 · Aug 17, 2017 at 08:43 PM · androidunity 5android buildfreezefreezing

Android APK freezes during level load but not in Unity Editor

I'm building a mobile game for android, and i've gotten pretty far with no issues. My scenes were loading properly and everything was working fine on both the Unity Editor and the Android APK until recently. I have a "Loading Page" transition into every scene. My game starts off with a splash scene, then loads to the transition "Loading Page" and then to the "Main Page". On both the Unity Editor and the Android APK, these all load fine. In my "Main Page", i have a "Start" button, which when clicked, it loads the "Game Page". In the Unity Editor, when i press the "Start" button everything runs smoothly and it loads perfectly fine. When i build the Android APK and try pressing the "Start" button on mobile, it takes me to the transition "Loading Page" no problem, but then just freezes and never loads the "Game Page". This has only started happening recently, and i have not made that many changes to my game. I went as far as to start a whole new project from scratch and building it all again and starting from today the issue has started again. I am using Photon Network, and thought that maybe that was the issue due to me just recently getting Unity_2017. I removed all Photon Network scripts and all assets from my project and loaded all scenes offline through SceneManager.LoadAsync, and am still getting the same issue.. I've tried loading other scenes other than the "Game Page" after the transition "Loading Page" but still the same issue. I removed all 3D objects from my scenes and even went as far as to removing all 3D objects from the project entirely.

I am confused as to what is going on here. If someone has some kind of answer to this or some way i can try to resolve this it would be greatly appreciated!!!! Please help!!

This is the code i am using to transition from scene to scene through the "Loading Page" :

using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; using UnityEngine.SceneManagement; using UnityEngine.EventSystems;

public class LoadingText : MonoBehaviour {

 private AsyncOperation ao;
 private int levelToLoad;
 private string lastLoadedScene;

 // Use this for initialization
 IEnumerator Start () {
     lastLoadedScene = getLastLoadedScene.getLastLevel ();
     if (lastLoadedScene == "SplashNameLoad") {
         levelToLoad = 2;
     }
     else if (lastLoadedScene == "Main") {
         levelToLoad = 3;
     }
     ao = SceneManager.LoadSceneAsync (levelToLoad);
     ao.allowSceneActivation = false;
     GetComponent<Text> ().text = "Loading";
     yield return new WaitForSeconds (0.5f);
     GetComponent<Text> ().text = "Loading.";
     yield return new WaitForSeconds (0.5f);
     GetComponent<Text> ().text = "Loading..";
     yield return new WaitForSeconds (0.5f);
     GetComponent<Text> ().text = "Loading...";
     yield return new WaitForSeconds (0.5f);
     GetComponent<Text> ().text = "Loading..";
     yield return new WaitForSeconds (0.5f);
     GetComponent<Text> ().text = "Loading.";
     yield return new WaitForSeconds (0.5f);
     GetComponent<Text> ().text = "Loading";
     ao.allowSceneActivation = true;
 }

}

Comment
Add comment · Show 9
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image wallblocking · Aug 18, 2017 at 01:11 AM 0
Share

@clunk47 Can you help with this, I am having same issue

avatar image wallblocking wallblocking · Aug 18, 2017 at 01:33 AM 0
Share

@hexagonius can you help with this, I am having same issue :)

avatar image hexagonius · Aug 18, 2017 at 07:40 AM 0
Share

What's the list of levels added in the build list in player settings? Can you also create a debug build, attach your phone or whatever to the computer with USB cable and run "adb logcat -s Unity" in your console? It should spit out information about the running game.

avatar image Jay1234 hexagonius · Aug 18, 2017 at 02:17 PM 0
Share

In my build list it goes :

splashNameLoad : 0 loadingPage : 1 mainPage : 2 gamePage : 3

on my main page, i call it to load the "loadingPage" by its build number. Which then transitions to the "gamePage" by it's build number as well.

I've also ran the adb logcat and filtered out for just Unity logs, and it shows nothing but my click or touch events. No errors at all... Even when it holds still (frozen) on the "loadingPage". It does however, still log my clicks or touches even after it freezes.

avatar image adrienPlayerium · Aug 18, 2017 at 08:40 AM 0
Share
         while (!ao.isDone)
         {
           yield return null;
         }
         Debug.Log(string.Format("additive load {0} completed", lvl2load));

Do your asyncOperation ever respond isDone?

avatar image Jay1234 adrienPlayerium · Aug 18, 2017 at 02:18 PM 0
Share

Hm, i'm assu$$anonymous$$g so since it works and fires fine in the Editor? I tried to keep my code as simple as possible and not add any while loops but i guess i'll try this to see if it is firing in the Android Build.

avatar image Jay1234 adrienPlayerium · Aug 18, 2017 at 02:47 PM 0
Share

Update :

while (!ao.isDone) { yield return null; } Debug.Log(string.Format("additive load {0} completed", levelToLoad));

This seems to not fire properly even in the editor. Seems to get stuck in the while loop and never come out of it. When i remove the while loop and just add the Debug.Log, it works and fires the log fine and all level loads in the Editor. $$anonymous$$obile device is still having the same issue.alt text

mobiledevicelogs.png (60.3 kB)
avatar image Jay1234 · Aug 18, 2017 at 03:06 PM 0
Share

Update :

 <i>AndroidPlayer(samsung_S$$anonymous$$-G928W8@192.168.2.10)</i> Unloading 6 Unused Serialized files (Serialized files now loaded: 0)

The above message comes up after i load into the "$$anonymous$$ain Page". It unloads everything basically, which is fine and i expected that. I then tap my button to load the "Loading Page", it loads fine. But then freezes when trying to load the "Game Page" and spits out this log message in the console :

 >AndroidPlayer(samsung_S$$anonymous$$-G928W8@192.168.2.10)</i> Unloading 0 Unused Serialized files (Serialized files now loaded: 0)

It's not loading anything! Even though in my script it loads fine in the Editor, it just doesn't want to load anything on the Android device... This makes no sense to me.. Oh, and this log just constantly keeps spitting out endlessly until i close the app. alt text

mobileunitylogs.png (52.3 kB)
avatar image adrienPlayerium Jay1234 · Aug 20, 2017 at 11:56 PM 0
Share

Those logs might happen on some devices in debug mode, might be related to huge Ressource.Load() calls.. That's probably why it's stuck on loading. It is difficult to figure it out without seeing the part of your project responsible for this issue you are having. If while(!async.isDone) doesn't break it means it is stuck on loading something.

2 Replies

· Add your reply
  • Sort: 
avatar image
1
Best Answer

Answer by Jay1234 · Aug 21, 2017 at 02:20 AM

I resolved and figured out the problem two nights actually, and it was exactly what you just mentioned. I had a Resources.load call running in the Update on a script in my "Main Page" without even realizing it. I definitely did not mean to plug it in there, but guess it got in there anyway lol. Just made it so difficult to find since no errors were pumping out and it was loading fine in the Editor. But once i removed the resources.load call from the Update everything ran smoothly again on mobile. I'll mark and accept your answer @adrienPlayerium since you technically had the right one even though you responded after it was resolved, appreciate your answer!

Comment
Add comment · Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image adrienPlayerium · Aug 21, 2017 at 02:24 AM 0
Share

@$$anonymous$$1234 thank you :D Sorry I couldn't help you in time ~ I got offline this weekend ~ Cheers glad you fixed it!

avatar image khaledr · Aug 29, 2018 at 11:57 AM 0
Share

in my case i still having this issue in android. i tested all the advises you mentioned ...

avatar image
0

Answer by AnisimovArthur · Feb 25, 2020 at 07:52 AM

Hey,

In my case the problem was in a camera in a scene. I change 'Target Eye' to none (main display) and 'clear flags' to Skybox.

Hope it will help!

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

205 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Creating Unity games for older versions of Android? 0 Answers

GVR Reticle not centered on android phone anymore. 1 Answer

i need help. Why my character looks so weird when i change Platform from standalone to android 0 Answers

Freeze when building 0 Answers

Error Building Android Player : Win32 Exception 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges