Project build lagging on android after unity update.
Hi To fulfill playstore requirements for 64bit code I moved my project from the old version of unity to 2017 that supports arm64.
The problem is that game build doesn't run good when exported to android. As per my perception Physics and mechanism of the game itself works fine and does not slow down but the display is kind off laggy. The problem didnt exist for the version built with 5.5. Tested on the same phones.
In editor it works fine both for 5.5 and 2017. Smoothly. The game has 300-500 fps in editor.
The game is very simple 2d platform. No lighting. PNG textures. It was tested multiple times after build in 5.5 and all worked perfectly fine.
I think unity 2017 put some options in the build that were not available in the 5.5. And those not necessary options. I was thinking to try it on 2019 as well.
How would you approach this problem? Thanks Wojtek
Answer by LOSTSOUL86 · Dec 29, 2019 at 09:49 AM
Hello, as I haven't received feedback here I investigated topic myself so I will put the answer.
I added fps measurement to both builds from Unity 5 and Unity 2017. For some reason the game build in Unity 5 was running at 60fps (update) on my phone. And the one compiled on unity 2017 was running at 30fps. - was looking laggy.
After changing to 60 fps on unity 2017 the lagging is not visible anymore.
Still questions to be answered - why Unity 5 was building project to work at 60fps? It was min quality with vsync off. And why Unity 2017 was building the same project for 30fps? I've found someone had similiar problem when moved project from U2017 to U2019. Anyway maybe this information will help someone. My game was with a lots of dynamic objects moving. It doesnt look good with only 30fps.
Answer by Ragee · Jul 11, 2020 at 03:28 PM
Hi @LOSTSOUL86 ,
I am not sure I understand what change you did to improve performance but I have exactly same same issue.
Game was originally published using Unity 5 and it was running very smooth on Android. I have now updated to 2019 and the performance is very poor.
Could you please explain the steps you took.
Hi,
I just hard coded the frame rate. I added new game object with new script to the first scene that appears in the game. (in my game the first scene is menu screen).
I put this instruction in the start function of the script:
Application.targetFrameRate = 60;
I didn't put it anywhere else. Just once at the beginning. It fixed the lagging issue for me. I have found out that in Unity 5 for Android compilation the game was running "automatically" at 60fps without the additional line of code. In Unity 2017 it was 30fps - so the game was lagging. I checked game both in 2017 and 2019. The behavior of the Game looked more similar to the original in 2017 after fixing the frame rate issue so I decided to finish the revision in 2017. But its not very good idea to use 2017 due to lack of proper prefabs management interface. I think it would be better to do 2019 even if more issues need to be fixed. The new revision of the game is co$$anonymous$$g this month, then I will move everything to 2019 and I will always use the latest editor.
You can also check the frame rate but do it on the actual Android device.
The script code:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class iAppFrameRate : $$anonymous$$onoBehaviour {
// Use this for initialization
void Start () {
Application.targetFrameRate = 60;
}
// Update is called once per frame
void Update () {
}
}
Awesome!
Thank you for that. At least on newer devices it looks good now.
But, there still seems to be something that's off on the older devices which used to look good.
The graphics settings are the same on very low.
Anyway, thank you for the answer I needed :)
Answer by AlexiFullerman · Aug 02, 2020 at 03:56 PM
Thank you!, I have worked on this for weeks, it's amazing something so simple could not have been automatically changed.