Created
September 12, 2018 10:17
-
-
Save 314pies/c9a63819051697846fc0f05a21afd56e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
public class SmoothSyncTest : MonoBehaviour { | |
// Use this for initialization | |
void Start () { | |
StartCoroutine(NetworkSyncEmulating()); | |
} | |
[SerializeField] | |
private float SyncRate = 0.1f; | |
[SerializeField] | |
private float MinLatency=0.03f, MaxLatency = 0.3f; | |
IEnumerator NetworkSyncEmulating() | |
{ | |
while (true) | |
{ | |
yield return new WaitForSeconds(SyncRate + Random.Range(MinLatency, MaxLatency)); | |
Debug.Log("Position Sync."); | |
//Invoke your synchronize method here | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment