- Home /
Is there any way to use Screen.SetResolution on Android without occasional screen flicker with Samsung Galaxy S4 Notification Panel?
I'm just about ready to give up on this problem. No matter what I try the Screen occasionally flickers after using:
Screen.SetResolution(1280, 720, true);
It's not a huge issue since I've set it up well enough now that it seems to only happen maybe like 1/5 times I start the game. But if it only happens occasionally is this just like a Unity or Android Bug?
I've also seen this occur in other professional apps with 100,000+ downloads on Android so is this just a problem with their system?
So one key thing to note about using Screen.SetResolution according to Unity documentation is:
"A resolution switch does not happen immediately; it will actually happen when the current frame is finished."
Makes sense but even with the following extreme solution I still get screen flickers on the Samsung Galaxy S4 but I've seemed to finally fix it on the Samsung Galaxy Nexus. I feel this is a bit rediculous to go to these extremes to begin with but I've created an empty scene with just one empty object and one script which is Scene(0). This new scene now plays before the Start Menu which should logically be the first (now takes longer to get to Start Screen).
This is the code I'm using in the empty scene before the Start Scene:
public class ResolutionSettingsScript : MonoBehaviour
{
int counter;
void Awake()
{
//make a public static variable for something here?
Screen.SetResolution(1280, 720, true);
}
void Start()
{
counter = 0;
//Application.LoadLevel("Start Menu");
}
void Update()
{
++ counter;
if (counter > 1)
{
Application.LoadLevel("Start Menu");
}
}
}
Notice the excessive counter to make EXTRA sure that the Screen.SetResolution would have time to update before the Start Screen displays.
This seems to have finally 100% fixed the issue on the Galaxy Nexus. But on the S4 the Splash Screen may distort to a larger size and move to the bottom right of the screen before displaying the Start Menu. And sometimes the Start Screen appears to flicker or warp even though the resolution was set before even getting there...
So I'm about to just give up and say there is some kind of buggy nonsense going on with the S4. I'm obviously a bit OCD just for spending this much time on a minor issue but it's kinda annoying and looks very unprofessional to me.
So I think the problem may be that Samsung Galaxy is pure Android no bloatware manufacturer garbage?
However the S4 will display the "Notification Panel" that is "It is accessible from any menu or application." according to:
I beleive this is the reason why the S4 will always have occasional screen flicker even with extreme examples attempting to prevent it.
About 33% of the time it works fine. 33% of the time the Splash Screen Warps. 33% of the time the Title Menu flickers.
This still occurs even with "Landscape Left" set, and "Status Bar Hidden" in the build settings, and even with that extreme and undesirable script example above trying to prevent any possibility of Screen flicker...
So I guess I give up on it, I've wasted enough time thinking it was my own fault but now I think it's just an S4 problem. Who knows how many other phones also have this issue...
But my question is can this be fixed on Unity's side so it's really their bug or is it a Samsung Android thing?
Hi, I have encounter same problem... $$anonymous$$aybe, it needs to modify low-level code. In XCode, I modify device setting to set resoulation. But, I do not have any ideal on Android.
Answer by Zeratu · Jun 04, 2015 at 12:04 PM
There is reason: Unity SDK has a bug when use Screen.SetResolution(),You should rewrite a .jar file ,and use unityPlayer.setScreenSize() Func in your new jar package.
there is a way to fix the problem.
Your answer
![](https://koobas.hobune.stream/wayback/20220613113615im_/https://answers.unity.com/themes/thub/images/avi.jpg)