Skip to content

Instantly share code, notes, and snippets.

@EliCDavis
Created April 29, 2021 13:36
Show Gist options
  • Save EliCDavis/fe77526e1841440c002cd336c7916288 to your computer and use it in GitHub Desktop.
Save EliCDavis/fe77526e1841440c002cd336c7916288 to your computer and use it in GitHub Desktop.
How to recursively add recorders to a root obj with Recolude
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using RecordAndPlay.Record;
public static class RecurseExample
{
public static void RecurseAdd(Recorder recorder, GameObject obj)
{
if (recorder == null)
{
throw new System.ArgumentNullException("Can not add with null recorder");
}
if (obj == null)
{
throw new System.ArgumentNullException("Can not record null gameobject");
}
SubjectBehavior.Build(obj, recorder);
for (int i = 0; i < obj.transform.childCount; i++)
{
RecurseAdd(recorder, obj.transform.GetChild(i).gameObject);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment