Skip to content

Commit

Permalink
fix: remove GC from demo
Browse files Browse the repository at this point in the history
  • Loading branch information
uweeby committed Feb 1, 2021
1 parent 71d9923 commit 2474a0c
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,12 @@ public class AdjustableLoad : NetworkBehaviour
[SyncVar]
public float Floaty;

public static WaitForSeconds wait1Sec;
public static float waitAmount;

public void Start()
{
wait1Sec = new WaitForSeconds(waitAmount);
StartCoroutine(Move());
}

Expand All @@ -23,7 +27,8 @@ private IEnumerator Move()
transform.position += transform.up * MovementSpeed * Time.deltaTime;
transform.Rotate(0, 0, Time.deltaTime * RotateSpeed);

yield return new WaitForSeconds(Random.Range(0f, 0.5f));
waitAmount = Random.Range(0, 0.5f);
yield return wait1Sec;
}
}
}
Expand Down

0 comments on commit 2474a0c

Please sign in to comment.