Skip to content

Instantly share code, notes, and snippets.

@movitto
Last active July 10, 2025 19:51
Show Gist options
  • Save movitto/42094865c769afa3ebd7ffca92de7541 to your computer and use it in GitHub Desktop.
Save movitto/42094865c769afa3ebd7ffca92de7541 to your computer and use it in GitHub Desktop.
Populates Unity Instant Timelapse Controller Screenshot A Day with the selected gameobject's children
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEditor;
using System.Collections.Generic;
using System.Linq;
using com.cyborgAssets.screenshotADay;
namespace DevNullProd{
namespace TheLongestTale{
namespace Editor{
// Finds and populates an instant timealpse controller
// with direct children of the selected gameobjects
public class PopulateInstantTimelapse {
private static InstantTimelapseController_ScreenshotADay ITC{
get{
return SceneManager.GetActiveScene().GetRootGameObjects()
.First(go => go.GetComponent<InstantTimelapseController_ScreenshotADay>() != null)
.GetComponent<InstantTimelapseController_ScreenshotADay>();
}
}
[MenuItem("Tools/DevNullProd/Populate Instant Timelapse")]
public static void DoExtract(){
InstantTimelapseController_ScreenshotADay itc = ITC;
itc.groups = new List<InstantTimelapseData_ScreenshotADay>();
int g = 0;
foreach(Object obj in Selection.objects){
if(itc.groups.Count <= g)
itc.groups.Add(new InstantTimelapseData_ScreenshotADay());
InstantTimelapseData_ScreenshotADay itcd = itc.groups[g];
if(itcd.gameObjects == null)
itcd.gameObjects = new List<GameObject>();
GameObject go = (GameObject)obj;
itcd.note = go.name;
foreach(Transform child in go.transform)
itcd.gameObjects.Add(child.gameObject);
++g;
}
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment