Search Unity

Question (STILL NOT FIXED) Unity 2D Mobile game crashes when you click the button to open another panel

Discussion in 'Editor & General Support' started by korotaevnikita73, Jan 12, 2022.

  1. korotaevnikita73

    korotaevnikita73

    Joined:
    Dec 24, 2017
    Posts:
    26
    I welcome everyone, I have a problem and I really want to deal with it. I created a 2D mobile game in Unity and I got an optimization problem. I have attached a video, this is a scene of a store from a computer. Everything works on it, but when you start the game from the phone for the first time, not only does it take a very long time to load when you go to the store scene, which I also don’t understand, maybe someone has an answer, so also when you click on the panel with the name "Donate", the game also freezes quite strongly, but the panel still switches, and if you then click on the panel with daily rewards (as I show in the video), the game just crashes. Also, in the opposite direction, if at the first opening of the game you can click on the daily rewards and everything will work well, then by clicking on the "Donate" panel, the game crashes. The most interesting thing is that when you re-enter the game, although with unpleasant sagging, it works as it should. There are suggestions that this is due to too many elements and text. In total, by the way, I have 18/31 drawcalls on the stage (I attached screenshots), I reduced them by creating Sprite Atlas. Maybe someone had similar problems? I would like to fix crashes / crashes and freezes.
    Screenshots and a video: https://youtu.be/T6tOG_StW68 devenv_cBvFj3vfFA.png Unity_exGPdrsOU5.png Unity_YZJmI39zpw.png
     
  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    38,726
    Check for while loops in one of the sub-panels that gets turned on. If you ever do a while loop to wait for Unity, it will 100% lock up until whatever function your loop is in actually returns. If you MUST loop, then it MUST be a coroutine.
     
  3. korotaevnikita73

    korotaevnikita73

    Joined:
    Dec 24, 2017
    Posts:
    26
    Hey, thanks for replying but i dont think thats the problem, i dont really have any scripts that contain while method, here is the settings for my empty panel with icons and for the icon itself Unity_VYTkTkNE5X.png Unity_4gQ6QglFz3.png
     
    Last edited: Jan 12, 2022
  4. korotaevnikita73

    korotaevnikita73

    Joined:
    Dec 24, 2017
    Posts:
    26
    I figured it out. The problem was, as I thought, not in the number of elements or the script. Just a bug in the engine. Updated from 2020 to 2021 Unity Editor and everything works perfectly, no freezes and no crashes!
     
  5. korotaevnikita73

    korotaevnikita73

    Joined:
    Dec 24, 2017
    Posts:
    26