Created
April 29, 2021 13:36
-
-
Save EliCDavis/fe77526e1841440c002cd336c7916288 to your computer and use it in GitHub Desktop.
How to recursively add recorders to a root obj with Recolude
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; | |
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