Skip to content

Instantly share code, notes, and snippets.

@nakamura001
Last active December 20, 2015 18:08
Show Gist options
  • Save nakamura001/6173401 to your computer and use it in GitHub Desktop.
Save nakamura001/6173401 to your computer and use it in GitHub Desktop.
[Unity]全ての子オブジェクトのスクリプトに対して、 enabled = false する
void StopUpdate(Transform t) {
for(int i=0; i<t.childCount; i++){
Transform child = t.GetChild (i);
StopUpdate(child);
foreach(MonoBehaviour mb in child.gameObject.GetComponents<MonoBehaviour>()) {
mb.enabled = false;
}
}
}
void OnMouseDown () {
StopUpdate(transform);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment