Game engine best practices

Use the following guidance to get the most out of Game Server Hosting when working with specific game engines.

Set target frame rate in Unity

To avoid causing your server to use 100% of your CPU, the recommended best practice is to set the target frame rate for a Unity server.

To set the target frame rate, add the following code into your server build:


using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class TargetFPS : MonoBehaviour
    public int target = 60;

    void Awake()
        QualitySettings.vSyncCount = 0;
        Application.targetFrameRate = target;