void NewUpdateBehaviorConn(int portId, bool onLoading) { InputPort inputPort = GetInputPortByUniqueId(portId); int channelsRequired = UIUtils.GetChannelsAmount(onLoading ? inputPort.DataType : inputPort.ConnectionType(0)); int availableChannels = UIUtils.GetChannelsAmount(m_selectedOutputType); // Invalidate previously used channels for (int i = 0; i < availableChannels; i++) { if (m_occupiedChannels[i] == portId) { m_occupiedChannels[i] = -1; m_inputPorts[i].Visible = true; } } // Lock available channels to port int len = Mathf.Min(portId + channelsRequired, availableChannels); int channelsUsed = 0; for (int i = portId; i < len; i++) { if (m_occupiedChannels[i] == -1) { m_occupiedChannels[i] = portId; channelsUsed += 1; } else { break; } } if (!onLoading) { inputPort.ChangeType(UIUtils.GetWireTypeForChannelAmount(channelsUsed), false); } if (channelsUsed > 1 && portId < availableChannels - 1) { channelsUsed -= 1; int i = portId + 1; for ( ; channelsUsed > 0; i++, --channelsUsed) { m_inputPorts[i].Visible = false; } } m_sizeIsDirty = true; }