public void OnBeforeSerialize() { serializedPorts = new SerPort[ports.Count]; int i = 0; foreach (BasePort port in ports.Values) { serializedPorts[i] = new SerPort(port); i++; } }
public void OnAfterDeserialize() { //Debug.Log("OnAfterDeserialize"); Init(); foreach (BasePort port in ports.Values) { SerPort serPort = serializedPorts.FirstOrDefault(sp => Equals(sp.Name, port.Name)); //if(serPort != null) //print("SerPort: " + serPort.Name + " "+serPort.CapacityMode + " " + serPort.Direction //+ " " +serPort.PortType.ToString()); if (serPort != null && serPort.CapacityMode == port.CapacityMode && serPort.Direction == port.Direction && Equals(serPort.PortType, port.PortType.AssemblyQualifiedName)) { serPort.Deserialize(port); //print("Deserialize"); } } serializedPorts = new SerPort[0]; updateAfterDeserializedFlag = true; }