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 class CSNC : MonoBehaviour
|
||||||
{
|
{
|
||||||
|
public float tickInterval = 5f; // x times per sec
|
||||||
public string ip;
|
public string ip;
|
||||||
public GameObjectManager manager;
|
public GameObjectManager manager;
|
||||||
|
private float lastPing = 0; //last time connected to server
|
||||||
public class EZtransform //ez consistent serialization of transforms
|
public class EZtransform //ez consistent serialization of transforms
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -79,9 +80,13 @@ public class CSNC : MonoBehaviour
|
|||||||
|
|
||||||
void FixedUpdate()
|
void FixedUpdate()
|
||||||
{
|
{
|
||||||
|
if (Time.timeSinceLevelLoad - (1000f / tickInterval) > lastPing)
|
||||||
|
{
|
||||||
|
lastPing = Time.timeSinceLevelLoad;
|
||||||
IEnumerator req = request();
|
IEnumerator req = request();
|
||||||
StartCoroutine(req);
|
StartCoroutine(req);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
IEnumerator request()
|
IEnumerator request()
|
||||||
{
|
{
|
||||||
//Debug.Log(GameObjectRegistry.instance.registeredObjects);
|
//Debug.Log(GameObjectRegistry.instance.registeredObjects);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user