//2.2 -> 2.2.1 private static void UpdateMappedAssemblyNames2(string storagePath) { GameObject storageGO = (GameObject)AssetDatabase.LoadAssetAtPath(storagePath, typeof(GameObject)); if (storageGO == null) { return; } if (!IsUpdateRequired(storageGO, 3)) { return; } storageGO = Instantiate(storageGO); PersistentClassMappingsStorage storage = storageGO.GetComponent <PersistentClassMappingsStorage>(); if (storage == null) { storage = storageGO.AddComponent <PersistentClassMappingsStorage>(); } storage.Version = RTSLVersion.Version.ToString(); storage.PatchCounter = 3; PersistentClassMapping[] mappings = storageGO.GetComponentsInChildren <PersistentClassMapping>(true); for (int i = 0; i < mappings.Length; ++i) { PersistentClassMapping mapping = mappings[i]; mapping.Version = RTSLVersion.Version.ToString(); mapping.MappedTypeName = FixTypeName2(mapping.MappedTypeName); mapping.MappedAssemblyName = FixAssemblyName2(mapping.MappedAssemblyQualifiedName, mapping.MappedNamespace, mapping.MappedAssemblyName); PersistentPropertyMapping[] properties = mapping.PropertyMappings; for (int j = 0; j < properties.Length; ++j) { PersistentPropertyMapping property = properties[j]; property.MappedTypeName = FixTypeName2(property.MappedTypeName); property.MappedAssemblyName = FixAssemblyName2(property.MappedAssemblyQualifiedName, property.MappedNamespace, property.MappedAssemblyName); } } EditorUtility.SetDirty(storageGO); PrefabUtility.SaveAsPrefabAsset(storageGO, storagePath); DestroyImmediate(storageGO); }
//2.05 -> 2.1 private static void UpdateTags(string storagePath) { GameObject storageGO = (GameObject)AssetDatabase.LoadAssetAtPath(storagePath, typeof(GameObject)); if (storageGO == null) { return; } if (!IsUpdateRequired(storageGO, 1)) { return; } storageGO = Instantiate(storageGO); PersistentClassMappingsStorage storage = storageGO.GetComponent <PersistentClassMappingsStorage>(); if (storage == null) { storage = storageGO.AddComponent <PersistentClassMappingsStorage>(); } storage.Version = new Version(2, 1).ToString(); storage.PatchCounter = 1; PersistentClassMapping[] mappings = storageGO.GetComponentsInChildren <PersistentClassMapping>(true); for (int i = 0; i < mappings.Length; ++i) { PersistentClassMapping mapping = mappings[i]; PersistentPropertyMapping[] properties = mapping.PropertyMappings; for (int j = 0; j < properties.Length; ++j) { PersistentPropertyMapping property = properties[j]; property.PersistentTag = j + 1; mapping.PersistentPropertyTag = j + 1; } } EditorUtility.SetDirty(storageGO); PrefabUtility.SaveAsPrefabAsset(storageGO, storagePath); DestroyImmediate(storageGO); }