internal static void RemoveAdditionalDataComponent([DisallowNull] Component additionalDataComponent, [DisallowNull] List <Type> componentsTypeToRemove) { using (ListPool <Component> .Get(out var components)) { // Fetch all components foreach (var type in componentsTypeToRemove) { components.AddRange(additionalDataComponent.GetComponents(type)); } // Remove all of them foreach (var mono in components) { RemoveComponentUtils.RemoveComponent(mono); } } }
static void RemoveComponentWithAdditionalData(MenuCommand command) { RemoveComponentUtils.RemoveComponent(command.context as Component); }