Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save NullEntity/f7e600d4659b81b1b0da883ebfea4fd9 to your computer and use it in GitHub Desktop.
Save NullEntity/f7e600d4659b81b1b0da883ebfea4fd9 to your computer and use it in GitHub Desktop.
private void BindStateMachineBehavioursInActiveScenes()
{
Enumerable.Range(0, SceneManager.sceneCount)
.Select(SceneManager.GetSceneAt)
.SelectMany(ZenUtilInternal.GetRootGameObjects)
.SelectMany(x => x.GetComponentsInChildren<Animator>(true))
.SelectMany(x => x.GetBehaviours<StateMachineBehaviour>())
.ForEach(Container.QueueForInject);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment