private static void InitComponets(BinaryNode domNode, GameObject go) { Component[] components = go.GetComponents(typeof(Component)); for (int i = 0; i < domNode.GetChildNum(); i++) { BinaryNode child = domNode.GetChild(i); if (!(child.GetName() != "Cop")) { string nodeAttr = GameSerializer.GetNodeAttr(child, "Type"); Component x = null; for (int j = 0; j < components.Length; j++) { if (!GameSerializer.isNull(components[j])) { string pureType = GameSerializer.GetPureType(components[j].GetType().ToString()); if (pureType.Equals(nodeAttr)) { x = components[j]; break; } } } if (x == null) { x = go.AddComponent(GameSerializer.GetType(nodeAttr)); } } } }