added tick interval options (to reduce network load from 80tps lololol)

This commit is contained in:
APEX FIGHT 2025-01-03 00:33:48 -05:00
parent ef941cd344
commit 62a1d22528

View File

@ -6,9 +6,10 @@ using UnityEngine.Networking;
public class CSNC : MonoBehaviour
{
public float tickInterval = 5f; // x times per sec
public string ip;
public GameObjectManager manager;
private float lastPing = 0; //last time connected to server
public class EZtransform //ez consistent serialization of transforms
{
@ -79,8 +80,12 @@ public class CSNC : MonoBehaviour
void FixedUpdate()
{
IEnumerator req = request();
StartCoroutine(req);
if (Time.timeSinceLevelLoad - (1000f / tickInterval) > lastPing)
{
lastPing = Time.timeSinceLevelLoad;
IEnumerator req = request();
StartCoroutine(req);
}
}
IEnumerator request()
{