Ejemplo n.º 1
0
    static string RenameResourcesFolder(AssetItem item)
    {
        string resourcesPath = item.path.Remove(item.path.IndexOf("Resources/") + "Resources".Length);

        if (AssetDatabase.IsValidFolder(resourcesPath))
        {
            if (!AssetDatabase.IsValidFolder(resourcesPath.Replace("Resources", "_Resources")))
            {
                try
                {
                    string error = AssetDatabase.RenameAsset(resourcesPath, "_Resources");
                    if (error != string.Empty)
                    {
                        Debug.LogError(error);
                    }

                    //Add new folder to the list of folders that was renamed
                    RenamedFolder rf = new RenamedFolder(resourcesPath, resourcesPath.Replace("Resources", "_Resources"));
                    renamedFolders.Add(rf);

                    AssetDatabase.Refresh();
                }
                catch (System.Exception ex)
                {
                    Debug.LogException(ex);
                }
            }
        }

        return(item.path.Replace("Resources/", "_Resources/"));
    }
Ejemplo n.º 2
0
	static string RenameResourcesFolder(AssetItem item)
	{
		string resourcesPath = item.path.Remove(item.path.IndexOf("Resources/") + "Resources".Length);

		if (AssetDatabase.IsValidFolder(resourcesPath))
		{
			if (!AssetDatabase.IsValidFolder(resourcesPath.Replace("Resources", "_Resources")))
			{
				try
				{
					string error = AssetDatabase.RenameAsset(resourcesPath, "_Resources");
					if (error != string.Empty)
					{
						Debug.LogError(error);
					}

					//Add new folder to the list of folders that was renamed
					RenamedFolder rf = new RenamedFolder(resourcesPath, resourcesPath.Replace("Resources", "_Resources"));
					renamedFolders.Add(rf);

					AssetDatabase.Refresh();
				}
				catch (System.Exception ex)
				{
					Debug.LogException(ex);
				}
			}
		}
		
		return item.path.Replace("Resources/", "_Resources/");
	}