using System.Collections; namespace Unity.VisualScripting { /// /// Merges two or more lists together. /// [UnitCategory("Collections/Lists")] [UnitOrder(7)] public sealed class MergeLists : MultiInputUnit { /// /// The merged list. /// [DoNotSerialize] [PortLabelHidden] public ValueOutput list { get; private set; } protected override void Definition() { list = ValueOutput(nameof(list), Merge); base.Definition(); foreach (var input in multiInputs) { Requirement(input, list); } } public IList Merge(Flow flow) { var list = new AotList(); for (var i = 0; i < inputCount; i++) { list.AddRange(flow.GetValue(multiInputs[i])); } return list; } } }