Hello I am making a 2D Side scroller and run at 1000 FPS. But I have trouble with some lags. Profiler says that the game runs neat to 1000 FPS but I have spike to 250 FPS every seconds (Gfx.waitForPresent).
Ok I now what it is: Graphics cards wait for vSync. But 1000 FPS and lag. WTF.
I have 3 plans of pooling object that I desactivate and activate when needed. I use Sprite Packer and to avoid texture loading lag I have added all sprites in an object on the scene (Cheap trick ineed) bu you cannot force unity to not unload sprites and destroy Atlas texture).
I use Physics Box2DCollider & Rigibody2D on my spawn and respawn point to detect Object. A rigidBody2D on my character and BoxCollider2D on Obstacles.
Graphics Setting is fast without shadows and light … (1000 FPS, great but still lags)
I have only 1 camera and UI is on Overlay Canvas. No logs while objects spawn.
14 Atlas at 2048x2048 for objects.
For the ground and the background I use Texture Mapping to simulate movement.
Any ideas on how to avoid lag?
Edit: I desactivate all Objects one by one and even with 0 GameObject in the scene till have spikes Gfx.WaitForPresent from 1000 FPS to 250 FPS.
This cause a little lag every seconds and I cannot achieve a very smooth movement for the background objects.
On Android tablet it is better than in the editor and WebGL release. But on IOS it is very jittered.