public void EditorSetting(bool children = false) { if (!this) { return; } var trans = this.transform; if (!trans) { Debug.LogWarning(string.Format("SETUPABLE_COMPONENT:BAD_TRANSFORM:{0}", this.name)); return; } if (children) { SetupableComponent.OnEditorSettingInChildren(trans); } else { this.OnEditorSetting(); this.OnEditorPostSetting(); } }
static void OnEditorSettingInChildren(Transform trans) { if (!trans) { return; } var components = trans.GetComponents <SetupableComponent>(); foreach (var component in components) { if (component) { component.OnEditorSetting(); } } for (int n = 0; n < trans.childCount; ++n) { var child = trans.GetChild(n); if (!child) { continue; } SetupableComponent.OnEditorSettingInChildren(child); } // NOTE: Post 는 역순으로 칠드런 부터 돌아야 한다. components = trans.GetComponents <SetupableComponent>(); foreach (var component in components) { if (component) { component.OnEditorPostSetting(); } } }