- Home /
Limit framerate on just a camera, not whole application?
I'm using this script to bring my framerate down to 20fps for an aesthetic effect public int target = 20;
// Use this for initialization
void Start () {
QualitySettings.vSyncCount = 0;
//Application.targetFrameRate = 20;
}
// Update is called once per frame
void Update () {
if (target != Application.targetFrameRate) {
Application.targetFrameRate = target;
}
}
}
However, that also affects the cursor moves, and I want to keep the low framerate just to the camera. Is this possible? (Preferably whilst also having the same performance-saving of rendering a lower frame-rate on the whole application, if possible.)
In your scripts where you don't want the framerate limited you could use FixedUpdate or a Coroutine.
Answer by JedBeryll · May 02, 2018 at 06:27 PM
Disable the camera component and manually call camera.Render in a coroutine.
If I disable the camera, does that break how the camera is working? I'm not familiar with co-routines, is that a script on the camera?
If you disable the camera, it won't render automatically. Then you can call Render manually whenever you want, the camera's settings will still apply. $$anonymous$$ake sure you only disable the camera component not the gameobject. Read up on coroutines here.
How do settings like FOV, projection and clipping planes work if the camera component is disabled? I've not used a coroutine script before and I'm still learning the coding side (certainly from scratch), are there any examples that would do similar to what I'm attempting? I'm really not sure where to start!
A camera is nothing but the settings you've mentioned. When a camera is "rendered" Unity actually takes those settings, deter$$anonymous$$e which renderers are within the viewing frustum of the camera and will render all those renderers with the settings of the camera.
Note that rendering a camera at a slower rate than the actual framerate only makes sense when you render to a RenderTexture. If you have for example a $$anonymous$$imap camera that directly renders to the screen on top of the main camera you can't render it at a slower rate since you have to render it every frame after the main camera has rendered.
Answer by SharkoFR · May 04, 2018 at 02:29 PM
you can limit framerate when the player are using a camera and remove limit when it use other
Trouble is I need the cursor to be software rendered, and that also gets limited so it has a draggy feel :/
Your answer
Follow this Question
Related Questions
How can I force FPS per camera? 1 Answer
Camera performance issue 0 Answers
How to make camera position relative to a specific target. 1 Answer
AddForceAtPosition not working? 1 Answer
Make camera only render LOD_2??? 0 Answers