Unity: Random near zero FPS drops on Android - android

First of all thanks for taking the time to read this question - we're thankful for any input/suggestions/thoughts.
In our Unity game, we're seeing a problem that we cannot solve for weeks. At random points in the game, the FPS drops to zero and nothing moves for 3-4 seconds, then everything gets updated in 1 frame as if the freeze has not happened. It seems it's a rendering problem because absolutely nothing goes wrong with the game's logic and functionalities, everything works as expected after the mini-freeze. Even the user's touches in that time window are processed afterward.
Clues:
Unity version: 2019.4.31f1
Optimized Frame Pacing: Disabled
Use incremental GC: Enabled
Target Architectures: ARMv7 + ARM64 built as an AAB file
Scripting Backend: IL2CPP
Graphics API: OpenGLES2
Application.targetFrameRate : 60
Vsync count: Don't Sync
Multithreaded Rendering: Enabled
Additional Information:
It is not a full freeze. New frames do get rendered if you wait long enough.
In the unity profiler we can see, that when the issue occurs the main thread seems to be waiting for "gfx.presentframe" on the render thread.
We could reproduce the issue on these devices: (All are 64-bit, Androids are 11 or 12)
Samsung Galaxy A30
Samsung S20 FE
Xiaomi Poco X3
Samsung A21s
Huawei Honor 50
Samsung S22 Ultra
Our problem is exactly like this Question, The difference is that in our game, Optimized Frame Pacing is already disabled, so disabling it cannot solve the issue for us.
Here's a Screenshot of the Unity profiler when this problem occurred, Look at the selected frame.
We are really stuck with the problem and any helpful thoughts or suggestions will make us smile! Thanks in Advance!

Related

#Unity Profiler shows rendering time increases by a lot on Android device? (Pixel 3)

I have a simple scene (show as below) with only one object
I want to test FPS on Android so I made a build and turned on profiler.
FPS was stable at 30 for about 10min and the then dropped to 17. Profiler shows that GFX.presentframe suddenly took very long
Any idea what's happening? Or is there a way I can dig further? This is on a pixel phone

V-sync won't disable in android build

As the title suggests I am having issues with v-sync on android. I've set the v sync Count to Don't sync in the qualitySettings panel for the used quality level. However when i run my application on the samsung galaxy S6 its having a constant fps of ~15 due to waiting on vsync to happen (where it is ~60 fps with some spikes to 30 without v-sync).
profiler with v-sync tracked:
profiler without v-sync tracked:
As you can see it is crealy caused by v-sync happening. What i find strangest about this is that this only started happening a couple of days ago, and was working fine before. Even going back to a commit that 100% worked before v-sync starts messing it up.
I'm using Unity 2017.2.1f1. And have not done any updates to my android version.
Could this be caused by my phone forcing v-sync in some way (or is it happening becuase it is in VR using a samsung gear? and if it is can i turn that off somehwere?
EDIT: Running my application in the editor doesn't have the issue and V-sync doesn't happen at all, neither does it try to v-sync when i'm running the application on a onePlus 3 in non-vr

Android - Unity3D freeze in splash screen on some phones

I have a problem with Unity3D. I created a game with Unity 4.6.2f1. My problem is, game crashes after splash screen(Like trying to open itself constantly). The weird part is, game works on my phones and my tablets perfectly. I have Nexus 5(With Android 5.1.1) , Iocean X7S(With Android 4.2.2) , PolyPad tablet(Android 4.2.2) , Teclast X98(Android 4.4.4). I had some beta testers which have LG G2 , Samsung S5660 , Sony Xperia Z3 , HTC M8. From these 4 phones only Samsung make it run while others failed. I first though that this is because display bits. So I unchecked 32 and 24 bits Display buffer. Same result. Then I triend to change forcing Open GL ES version. I tried to build it with "Automatic" section - I don't know if its failed or not but It started to fade to black after a time even in my devices so I guess It's not an option for fixing. Then I tried to force it to use Open GL ES 3.0 , failed again. Then I read in somewhere that my AdMob plugin might be the reason , so I removed the components of AdMob from scenes and deleted all AdMob Plugin files. Same result. Since the crashed phones are not under my control , Its really hard to detect real problem easily because I really need to beg to my friends for every test since my testers are my friends and they have their own personal life, according to them its more important than testing my game whole day. By the way , I would like to add this too , like a month ago , everything were alright. It was running normal on my friends phone(The one who has G2). I'm getting suspicious from signing the apk. Because before signing it , while I was sending it without sign , It was working. That might be wrong idea of course. I'm not an expert so Im here for your helps. I really would like to know why this is happening and I want to fix this. Thanks!
Okay , I found the solution. It turns out that one of my script was responsible for this problem. So I deleted it and rewrite another script that do the same job. I assume, script was trying to use RAM over and over , so because of that, Adreno 330 type processors try to block the App's Open GL for preventing phone from total crash. This is only assumption of course. But If you are having a problem like I had , especially in Adreno 330 processors, try to check your codes first for any overloading.
I have faced similar issues, sometimes the problem was the memory of the device, null reference etc. also you could try forcing Open GL ES 2.0
srry can't make comments

Adreno 420 driver bug on Android 5.1

Just wanted to share an experience I had to see if anyone came across such issue, if they found the cause and more importantly how they fixed it.
The problem is pretty simple: while debugging native code on a Nexus 6, which as the Adreno 420 GPU, eglSwapBuffer could crash under certain circumstances when using Android 5.1 (5.0 worked perfectly).
Since I could not repro it I am unable to tell you what went wrong. According to the documentation, elgSwapBuffer calls internally glFlush; and so if I call glFlush before calling eglSwapBuffer all of a sudden it works perfectly.
My guess is that the driver does not flush properly thus crashing when swaping the buffers.
Any comments on this?
Cheers,
D
I'm having the same problem and I can reproduce it. It happens obviously because it runs out of stack memory due to deep nested loops in the rendering process.
Android Lollipop 5.1: Fatal signal 11 (SIGSEGV), code 2, fault addr 0x9e985ff8 in tid 4093 (RenderThread) / when using lot of nine patch graphics
I've already reported it to the google issue tracker:
https://code.google.com/p/android/issues/detail?id=163100
Update: Meanwhile I found a way to work around this issue. It's definitely not a long time solution, but for the moment, it's just the best available to stop my apps from crashing.
I disabled GPU rendering for particular graphic layers. It slows the drawing down a bit, but not significant.
So the nightmare is over for now, but I still think, this issue must be fixed on the driver itself. It cannot be that something that worked perfect with 5.0.2 and below, immediately stops to work with 5.1.
I have seen some weird behavior on the N6 as well, and while I cannot rule out app bugs, it looks to me like the Adreno driver is to blame.
Specifically, in landscape mode, our GLSurfaceView only renders one half of it's content, but occasionally flickers all of it. And with certain scenes being rendered there is intermittent flickering. In a case of extra weirdness, I have seen one half of the screen completely freeze, stuck on app content, even after returning to the launcher via the home button. It appears kind of like it would if it used multi stream transport and one of the streams was getting lost.

Trivial Haxe (HaxePunk) game runs far too slow on HTC Desire (Icecream Sandwich)

I've made a simple, 3 frame, animation of a character walking to wherever you click on screen using Haxe+ Haxepunk... Well I copy/pasted code from online tutorials just to test Haxe out.
This runs great in flash, iOS simulator and on a Samsung Galaxy 3... But on my HTC desire it runs at less than 1 frame per second. While I know the desire is no spring chicken this is a massive performance gap, more so than I've seen on any app re: Galaxy vs. Desire...
Is this a Haxe problem or something I have done wrong (wrong NDK, wrong compile flags, OS too old, etc)?
Go into Engine.hx, the render() function, and comment out HXP.screen.refresh(). This line is absolutely killing performance on OUYA (an android gaming console) so it might be killing you too. Since you're not clearing the screen every frame anymore you'll want to draw a background every update by adding a Backdrop instance to your world. My game goes from 7 fps to 52 fps with these changes alone at 1080p resolution and ~80 entities.
Also try grabbing the latest HaxePunk from github and running ant to install it, the devs have been working on android performance lately and there's some good unreleased fixes which will be cream on top of the above fix.

Categories

Resources