# CopyAssets(string[], string[])

> Duplicates assets in paths and stores them in newPaths.

## Definition

* **Type:** Method
* **Namespace:** [UnityEditor](/engine/6000.5/script-reference/unityeditor.md)
* **Assembly:** UnityEditor.CoreModule

```csharp
public static bool CopyAssets(string[] paths, string[] newPaths)
```

### Parameters

**** (\[string\[]]\(https\://learn.microsoft.com/dotnet/api/system.string)): Filesystem paths of the source assets.**** (\[string\[]]\(https\://learn.microsoft.com/dotnet/api/system.string)): Filesystem paths of the new assets to create.

### Returns

| Type                                                          | Description                                                                             |
| ------------------------------------------------------------- | --------------------------------------------------------------------------------------- |
| [bool](https://learn.microsoft.com/dotnet/api/system.boolean) | Returns true if the copy operation is successful or false if part of the process fails. |

### Remarks

All paths are relative to the project folder, for example: "Assets/MyTextures/hello.png". `paths` and `newPaths` must contain the same number of items.

```csharp
using UnityEngine;
using UnityEditor;

public class AssetDatabaseExamples : MonoBehaviour
{
    [MenuItem("AssetDatabase/Duplicate Materials")]
    static void DuplicateMaterials()
    {
        string[] sourcePaths = new []
        {
            "Assets/Materials/CarMaterial.mat",
            "Assets/Materials/TruckMaterial",
            "Assets/Materials/BoatMaterial"
        };
        string[] targetPaths = new []
        {
            "Assets/Duplicates/Materials/CarMaterial_Dup.mat",
            "Assets/Duplicates/Materials/TruckMaterial_Dup",
            "Assets/Duplicates/Materials/BoatMaterial_Dup"
        };
        if(!AssetDatabase.CopyAssets(sourcePaths, targetPaths))
            Debug.LogWarning($"Failed to copy assets");
    }
}
```

You cannot use this function during an import (either in process or from an asset worker), as it would result in new assets created in the middle of an import. Any errors and warnings from the copy operation are reported in the log and the console.
