private static SubBuildingsDefinition ReadDefinition(string subBuildingsDefPath)
        {
            if (!File.Exists(subBuildingsDefPath))
            {
                return(null);
            }
            SubBuildingsDefinition subBuildingsDef = null;
            var xmlSerializer = new XmlSerializer(typeof(SubBuildingsDefinition));

            using (StreamReader streamReader = new System.IO.StreamReader(subBuildingsDefPath))
            {
                subBuildingsDef = xmlSerializer.Deserialize(streamReader) as SubBuildingsDefinition;
            }
            return(subBuildingsDef);
        }
 public static void Save(SubBuildingsDefinition instance)
 {
     if (instance != null)
     {
         var                     configPath    = Path.Combine(DataLocation.assetsPath, "SubBuildingsDefinition.xml");
         XmlSerializer           xmlSerializer = new XmlSerializer(typeof(SubBuildingsDefinition));
         XmlSerializerNamespaces noNamespaces  = new XmlSerializerNamespaces();
         noNamespaces.Add("", "");
         try
         {
             using (StreamWriter streamWriter = new System.IO.StreamWriter(configPath))
             {
                 xmlSerializer.Serialize(streamWriter, instance, noNamespaces);
             }
         }
         catch (Exception e)
         {
             Debug.LogException(e);
         }
     }
 }