- Home /
I found out that the problem was elsewehre
Force 60 FPS on Unity
I can't achieve 60 FPS in a Unity Build on my Android device.
What I tried:
QualitySettings.vSyncCount = 0;
Application.targetFrameRate = 60;
Set Project Settings/Quality/VSyncCount to Don't Sync
Remove everything from the scene, there's only a camera and still locked 30 fps
Note: I achieved 60 FPS on this device before, so I don't see what's wrong now
EDIT: This code looks laggy/ugly at 30 fps. It moves a sprite from a position, to an other.
public IEnumerator MovePieceRoutine(Vector2 from, Vector2 to, Transform piece, Vector2 targetPiecePos) { piece.parent = camera.transform; float timePassed = 0; Vector2 originalPiecePos = piece.localPosition; while (timePassed < MovePieceAnimTime) { float t = timePassed / MovePieceAnimTime; Vector3 currentPosition = Vector2.Lerp(from, to, t); currentPosition.z = CameraZ; transform.position = currentPosition; Vector3 currentOffset = Vector3.Lerp(originalPiecePos, targetPiecePos, t); currentOffset.z = piece.localPosition.z; piece.localPosition = currentOffset; timePassed += Time.deltaTime; yield return null; } transform.position = new Vector3(to.x, to.y, CameraZ); piece.localPosition = new Vector3(targetPiecePos.x, targetPiecePos.y, piece.localPosition.z); }
https://docs.unity3d.com/ScriptReference/Application-targetFrameRate.html
Instructs game to try to render at a specified frame rate.
The default targetFrameRate is a special value -1, which indicates that the game should render at the platform's default frame rate. This default rate depends on the platform:
On mobile platforms the default frame rate is less than the maximum achievable frame rate due to need to conserve battery power. Typically on mobile platforms the default frame rate is 30 frames per second.
Hello, I am facing similar issue. Can you share what you found to fix this issue?
Answer by RadonRaph · Jan 15, 2020 at 11:06 AM
Actually you don't wan't your game to run at 60 FPS on android. Android is a system that manage itself so it will limit your framerates to avoid using too much battery. Nothing in unity can changes this its in android.
If your game need to run at 60 fps to be smooth its a problem :/ Verify thats your using FixedUpdate in deplacements and physics.
Raph
Well I am using camera zoom/movement animations with coroutines. With 30 fps, it looks laggy, so it is quite essential at the moment.
Follow this Question
Related Questions
How to port game on android wear ? 2 Answers
Unable to instantiate UnityPlayerActivity 1 Answer
Unity2D quads not appearing in front of other quads in Android build 1 Answer
Failed to find Build Tools revision 29.0.0 - Android Builds 4 Answers
Changing texture at runtime not working on android build 1 Answer