Hello! I have a scene with two cameras.One of them, for a 2d canvas and the another for the 3d world.The camera for the 3d world is rendering over a render texture which is drawn in a plane in the 2d camera.
I have multirendering option off,vsync off,using Open GLES 2,and I have the latest version of unity(5.6.2.f1).Some times the frame rate is 60 but some times the fps are lower(40,30),and the profiler show me the next :
the graphics.present and sync is blocking with 18 ms.Why?
In editor mode this problem not appears,and the frame rate is constant.
Graphics.presentAndSync is usually the GPU waiting for VSync, strange that it would happen with vsync off.
I have a script with this code inside,it´s run when the application starts at first time:
public class ApplicationFrameRateSetup : MonoBehaviour
{
public int FrameRate = 60;
// Use this for initialization
void Awake ()
{
Application.targetFrameRate = FrameRate;
QualitySettings.vSyncCount = 0;
}
}
I have created a new scene,without code.I have inserted the 3d scene.I have change to the default unity material in all objects,I have attached this script to a gameobject to disable the vsync.I have the UI Canvas in the same camera that the 3d scene and the results is the same,present and sync is in profiler with less time,but it is present(5.48 ms).
I am using android platform and a p8 lite mobile with marshmallow so.
Oh, I think mobile devices have VSync enabled by default, and it cannot be turned off. Turning it off in code/settings does nothing. At least, that’s how it is in iOS and I think Android is similar (could be wrong)
So here’s what happens in that situation - your game is running at 60fps, something causes a slight framedrop, it takes just barely longer than one frame to render everything. So to avoid tearing, Unity waits for the next VSync to render anything.
I think so,but the crazy thing is that the framedrop is random.Sometimes I run the same scene and the mobile always stays in 60 fps and in another moment of the day I play to the game my framerate is lower. Perhaps the temperature in these days in spain is the cause of this, i dont have another response.Then I will try to decrease the game features to ensurance the temperature problem.Some times a simple lensflare is a problem and another times not. The battery is not important,i have found the problem with full charge too. So, improve performance is the unique solution.It´s crazy why when i think that the problem is solved,later in another session I can see that the problem persist. Much thanks, if somebody have the same problem,please try to write to me.