diff --git a/Instancer.cs b/Instancer.cs index 2a82581..5ddf2ce 100644 --- a/Instancer.cs +++ b/Instancer.cs @@ -15,7 +15,7 @@ public class Instancer : MonoBehaviour static Instancer() { - renameInstances = PlayerPrefs.GetString("VRLabs.Instancer.RenameInstances", "True") == "True"; ; + renameInstances = PlayerPrefs.GetString("VRLabs.Instancer.RenameInstances", "False") == "True"; ; } [MenuItem("VRLabs/Rename new Instances", priority = 1)] @@ -255,6 +255,7 @@ static void FixReferences(string[] localAssetPaths, string sourceFolder, string bool newChanged = false; do { + if (property.propertyPath.Contains("m_Modification")) continue; if (property.propertyType == SerializedPropertyType.ObjectReference) { if (property.objectReferenceValue != null) @@ -297,17 +298,6 @@ static void RenameInstance(string[] localAssetPaths, string targetFolder, string UnityEngine.Object[] targetAssets = AssetDatabase.LoadAllAssetsAtPath(targetAssetPath).Where(x => x != null).ToArray(); if (targetAssets.Length == 0) continue; string[] possibleNames = new []{packageName, packageName.Replace("-", ""), packageName.Replace("-", " ")}; - - String fileName = Path.GetFileName(targetAssetPath); - foreach (string possibleName in possibleNames) - { - if (fileName.StartsWith(possibleName)) - { - fileName = ReplaceAtStart(fileName, possibleName, newInstanceName); - AssetDatabase.RenameAsset(targetAssetPath, fileName); - break; - } - } foreach (var targetAsset in targetAssets) { @@ -315,6 +305,7 @@ static void RenameInstance(string[] localAssetPaths, string targetFolder, string SerializedProperty property = serializedObject.GetIterator(); do { + if (property.propertyPath.Contains("m_Modification")) continue; if (property.propertyType == SerializedPropertyType.String) { string value = property.stringValue; @@ -333,6 +324,17 @@ static void RenameInstance(string[] localAssetPaths, string targetFolder, string serializedObject.ApplyModifiedProperties(); } + + String fileName = Path.GetFileName(targetAssetPath); + foreach (string possibleName in possibleNames) + { + if (fileName.StartsWith(possibleName)) + { + fileName = ReplaceAtStart(fileName, possibleName, newInstanceName); + AssetDatabase.RenameAsset(targetAssetPath, fileName); + break; + } + } } } diff --git a/Readme.md b/README.md similarity index 100% rename from Readme.md rename to README.md diff --git a/Readme.md.meta b/README.md.meta similarity index 100% rename from Readme.md.meta rename to README.md.meta