Skip to content

Instantly share code, notes, and snippets.


Block or report user

Report or block Thomas-6freedom

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
SoylentGraham / gist:bef991c9cd38f9b9c39e549bfcfb05a9
Created Sep 13, 2017
Unity Find all objects of type in a scene including inactive
View gist:bef991c9cd38f9b9c39e549bfcfb05a9
static T[] FindObjectsOfTypeIncludingDisabled<T>()
var ActiveScene = UnityEngine.SceneManagement.SceneManager.GetActiveScene ();
var RootObjects = ActiveScene.GetRootGameObjects ();
var MatchObjects = new List<T> ();
foreach (var ro in RootObjects) {
var Matches = ro.GetComponentsInChildren<T> (true);
MatchObjects.AddRange (Matches);
You can’t perform that action at this time.