diff --git a/Editor/Helpers/AssetDatabaseHelper.cs b/Editor/Helpers/AssetDatabaseHelper.cs index 6c4a50b..1985665 100644 --- a/Editor/Helpers/AssetDatabaseHelper.cs +++ b/Editor/Helpers/AssetDatabaseHelper.cs @@ -24,6 +24,23 @@ public static Type GetTypeFromGUID(string guid) return script == null ? null : script.GetClassType(); } + + /// + /// Returns a unique GUID that is known to have no conflicts with the existing assets, so that you create a new asset manually. + /// + /// A unique asset GUID. + public static string GetUniqueGUID() + { + GUID newGUID; + + do + { + newGUID = GUID.Generate(); + } + while ( ! string.IsNullOrEmpty(AssetDatabase.GUIDToAssetPath(newGUID.ToString()))); + + return newGUID.ToString(); + } /// /// Completely prevents AssetDatabase from importing assets or refreshin.