added tick interval options (to reduce network load from 80tps lololol)
This commit is contained in:
parent
ef941cd344
commit
62a1d22528
@ -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()
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user