1
\$\begingroup\$

For the past month i've been working on a vr project and i wonder if i can obliged players to be on 90hz when playing the game because if player use 60hz then the game becomes laggy and since 90hz is the default meta quest refresh rate it still gets a bit laggy when you run on lower than 90hz. Any tips?

DMGregory
140k23 gold badges256 silver badges392 bronze badges
asked Apr 25 at 10:15
\$\endgroup\$
1
  • \$\begingroup\$ The way to show that a question has been answered is to click the ✅ icon beside the answer that solved your problem (in this case, "upgrade to Unity 6"). Adding "fixed" to your title does not mark the question as answered. \$\endgroup\$ Commented Apr 29 at 21:22

3 Answers 3

1
\$\begingroup\$

It's possible to set a maximum frame rate in your game but not possible to set a minimum frame rate, unless you want to do something silly like closing the game when the frame rate drops below your target, but why would you do that?

Setting the maximum frame rate can be done either by enabling VSync to limit the framerate to the user display's refresh rate (60Hz = 60FPS, 120Hz = 120FPS, etc.) or by artificially limiting the frame rate by pausing the game loop if it's running faster. Most game engines have this functionality built into the engine itself, for example in Unity you simply do Application.targetFrameRate = 90; (or whatever your target framerate is). If you are using your own game loop it would look something like this:

var DESIRED_FPS = 90
var DESIRED_MILLISECONDS_PER_FRAME = 1000 / DESIRED_FPS
var start = Now() // In this example Now() returns milliseconds since epoch
Update()
Render()
var end = Now()
var timeSpentOnFrame = end - start
Sleep(DESIRED_MILLISECONDS_PER_FRAME - timeSpentOnFrame)
answered Apr 25 at 23:00
\$\endgroup\$
1
\$\begingroup\$

If your frame rate is sometimes lower than you'd like, then one option is to enable dynamic resolution to enable you to dynamically sacrifice rendering resolution in order to maintain a higher frame rate.

Meta Quest apparently has some platform specific support for dynamic resolution, although I'm not familiar with it myself.

Note that dynamic resolution won't help if the performance of the game is being limited by the CPU and not the GPU. For CPU bound cases, you'll need to profile the game, and optimize the slowest parts.

answered Apr 28 at 22:00
\$\endgroup\$
0
\$\begingroup\$

Thank you guys for your responses, with the new Unity 6 optimization features it helped me a lot with optimization! I used the GPU Resident Drawer which helped me save a lot of frames especially in VR where optimization becomes complicated. You can learn more about it here: Unity 6 GPU Resident Drawer

Pikalek
13.3k5 gold badges49 silver badges54 bronze badges
answered Apr 29 at 21:13
\$\endgroup\$
1
  • 2
    \$\begingroup\$ This answer would be more useful to future readers if you included a bit more description about how you used Unity 6's optimization features to achieve your target performance. \$\endgroup\$ Commented Apr 29 at 21:23

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.