Framerate drops after Unity Ad runs - Android

I’m having trouble with Unity Ads dropping the framerate on my game by 25% on an Android device after an ad runs (Samsung Galaxy S3 specifically). I’ve only tested on 2 Android devices at this point, but I’m worried this could get worse with a wider array of devices.

The strange thing is, if I press the ‘home’ key, then go back into the game, the framerate pops back up again.I’m not using OnApplicationFocus/OnApplicationPause, so it’s not something I am doing after the game comes back from the home screen.

I am in communication with Unity Ads team, but they cannot replicate on their end.

Does anyone else have this issue?

This has been reported many times, but we’ve so far been unable to reproduce it.

There’s at least three theories about the cause:

  • Vsync (unlikely, since it occurs after the ad has played)
  • Garbage collection on Android
  • Android device reducing power intake to cool down

It doesn’t apparently affect all devices.

I hope this helps.

quick workaround is just having an enumerator yield null for 5 frames after getting a ShowResult when its done

@mikaisomaa @AVOlight_1 I tried the enumerator yield, but no luck. Thanks for the idea, it was worth a shot.

The problem is that the framerate continues to remain low indefinitely after it drops from the Ad running. The only way to bring the framerate back is to press the “Home” key, then go back to the app. Note that I am not killing the app, then going back in. I’m just pressing the home key, then pressing the app icon again with the app still running. It’s like Unity is still holding onto memory or something, then it gets refreshed after home and back.

I actually duplicated the same exact thing on a Samsung Galaxy Note 4 today, so this is now happening on 2 of the 4 devices I’ve tried it on. I have no doubt this will bite me when release to a bigger audience.

@breban1 if you get the chance could you check if it happens in mine? https://play.google.com/store/apps/details?id=com.AVOlight.GrowToRise

@breban1 - we’re trying to reproduce said issue. I’ll post any findings here.

1 Like

I noticed something that may be related. When i build my project directly on the tablet and it starts, most of the time it won’t run as it should. But if i close it and then just run it normally from the device it will run nicely.
Perhaps it’s something with the process of when the app is halted and going to the background and then brought back in?

It’s hard to tell if the framerate drops after an Ad, but I think it does. Is there a way to turn FPS on the screen?

Also, is there a way to follow a post? I want to be notified by email when someone reply’s to my post. I see the alert when I log in, but receiving an email would be better.

1 Like

I got to test my game on a Samsung Galaxy Note 4 and a Galaxy S5 this past weekend, here are the results:

Galaxy S5: No framerate drop after Unity Ad runs
Galaxy Note 4: Framerate drops ~30% after Unity Ad runs.

Thank you @breban1 for checking. haven’t added an FPS panel for it. mostly trying to make sure there isn’t any major lag issues.

yea bit confused about how it works; but pretty sure i get an email on the first reply after i’ve replied on a thread

1 Like

Hello I am experiencing the exact same issue reported in this thread. I run my game and get 60fps on an Android tablet. Then after showing a Unity Video Reward Ad, the game has an inconsistent frame rate. The gameplay quality is noticeably reduced due to this.

I am using Unity 5.5.

Previously I was using and older version of unity (Sorry I don’t have the version…it was either an earlier version of 5 or Unity 4). I enabled the “Multithreading Rendering” feature when I built the game. When the game was built and launched, I noticed a very similar situation. I was getting an inconsistent frame rate. I found a few links related to this problem which told me to disable “Multithreaded Rendering”. I did this and the problem went away. Coming Soon

I have included the previous info as the frame rate slow down is the same. Perhaps this can help you track down what the problem is. It seems possible that there are resources created during the display of Ads which are not properly cleared up. (Ex// missing a thread.join call)

I am hopeful Unity will be able to find a fix for this issue. Otherwise I won’t be able to release my game with Unity Ads.

1 Like

@ericdstock thanks for jumping in!

I still haven’t had any luck resolving the issue, maybe your multithreaded problem will give the Unity team some ideas. Unity team hasn’t had any luck fixing either unfortunately.

On the multithreaded options: I have multithreaded rendering on and I have consistent framerates before an ad runs (60fps). As a side note, I now default my game to targetFPS to 30 and the issue isn’t noticable. After an ad runs my game stays at 30fps, it isn’t jittery like it is when I set it to 60fps. I know it’s a sucky option, but it’s an option nonetheless.

I have a feeling most teams default to 30fps and never notice the issue we’re having, OR there is some difference in our projects that cause the issue.

I’ve had this issue since Unity 4.6 (using 5.4.1p2 now).

Brian

@ericdstock I forgot to ask, does your FPS recover when you press the home key on your device, then go back to the game? Not rerunning it, just maximizing it again?

Brian

@breban1 I have the exact same problem, and when i press me home button and go back to the game, even if it only takes a fraction of a second, it returns everything to normal. Some part of memory must unload when going to home screen, so I would think its a memory issue?

1 Like

The problem isn’t just a FPS drop for a few seconds after an ad runs, it lowers the FPS indefinitely until you press the home key, then go back to the game.

My game starts at 60fps while playing, as long as I want to play, but immediately after a Unity ads runs, it goes down to ~42fps (very jerky/inconsistent looking), and continues like that for the remainder of play.

I did try yield null just in case it was a fix, but it did not fix the problem.

@Incode If you could send Unity your project along with a link to this post it may help them track this problem down. It has to be happening to more customers than just us few that are responding.

I’m still defaulting my game at 30fps, but it looks SO much better at 60.

Do you have the last version of unity ads?

I remember now that long time ago I saw this issue on some device. After showing an ad the framerate drops.
But seems that it was solved or I changed something that made it solved. Not sure.

p3dart-es I’m using the latest revision of Unity Ads 2.x, and have been using Unity 5.4.3p4, so I’m pretty caught up. I had a few weird issues with 5.5 so I didn’t fully integrate to it.

Maybe you did something to solve the issue. If you use SC, can you check your checkins for ‘fixed framerate issue’? You never know!

And yes, it’s only happening on certain devices, although the ones that I have access to it is happening on 50% of them (2 of 4).

Thanks!

sorry, what did you mean with SC?

Sorry, lazy typer…

If you are using source control, can you look at your commits to see if there are any obvious descriptions that mention “framerate” or something to do with ads and framerate?