Owl-Man / FPS-Controller-for-Unity

FPS (Frames Per Second) Controller for Unity

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

FPS (Frame Per Second) Controller for Unity

By moving the FPS controller.cs script to the folder with your other scripts, you can limit the frame rate using the inspector in the Unity (changing the FPS integer variable) or by calling the SetFPS method. Also, through the inspector (changing the isVSyncActive bool variable) or by calling the DisableVSync/EnableVSync method, you can turn off and turn on VSync (Vertical Sync). All these methods are located in the FPS Controller class, which can be accessed using a singleton.

Example:

using UnityEngine;

public class Test : MonoBehaviour
{
    private FPSController FPSCntrl;
    
    private void Start() 
    {
        FPSCntrl = FPSController.instance;
        
        FPSCntrl.DisableVSync();
        FPSCntrl.SetFPS(60);
    }
}

FPS Controller script must be located in the scene and only once, to use its functions

About

FPS (Frames Per Second) Controller for Unity


Languages

Language:C# 100.0%