summaryrefslogtreecommitdiff
path: root/GameCode/LowFrameRate.cs
blob: 1c86586b48f626b1e7efa583b9e88786ff24aa1b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
using Photon.Pun;
using UnityEngine;

public class LowFrameRate : MonoBehaviourPunCallbacks
{
	public enum SlowWhat
	{
		Both,
		Server,
		Client
	}

	public SlowWhat slowWhat = SlowWhat.Server;

	public int targetFrameRate = 10;

	public override void OnJoinedRoom()
	{
		base.OnJoinedRoom();
		if (slowWhat == SlowWhat.Both || (PhotonNetwork.IsMasterClient && slowWhat == SlowWhat.Server) || (!PhotonNetwork.IsMasterClient && slowWhat == SlowWhat.Client))
		{
			Application.targetFrameRate = targetFrameRate;
			QualitySettings.vSyncCount = 0;
		}
		else
		{
			Application.targetFrameRate = 100;
		}
	}
}