Skip to main content


Checkpoints save random number state during capture and restore them during replay.

Unlike barriers this function's call order can change between capture and replay.

When to use it#

This API can be used at the end of multiple asynchronous operations executed in parallel to maintain the random number sequence.

Because these operations can end in any order and then call UnityEngine.Random, the random sequence can be different between capture and replay. Checkpoints allow you to accommodate for such scenarios.

Example - Async loading#

IEnumerator Start()
var uwr = UnityWebRequestAssetBundle.GetAssetBundle("http://server/myBundle.unity3d");
yield return uwr.SendWebRequest();
// Get an asset from the bundle and instantiate it.
AssetBundle bundle = DownloadHandlerAssetBundle.GetContent(uwr);
var loadAsset = bundle.LoadAssetAsync<GameObject>("Assets/Players/MainPlayer.prefab");
yield return loadAsset;
// Do random stuff using UnityEngine.Random class.

Example - introducing optional random states#

public void AnimationSequence() {
int animationMode;
if (randomMode) {
animationMode = Random.Range(minValue ,maxValue)
} else {
animationMode = Character.GetMode();