Copies a file or a directory.
This function's path can be relative to the project root folder or be an absolute path.
All file separators should be forward ones "/".
Make sure to include the name of the files or directories at the end of the "to" argument.
#pragma strict public class CopyFile extends MonoBehaviour { @MenuItem("Example/Copy Something") static function CopySomething() { FileUtil.CopyFileOrDirectory("sourcepath/YourFileOrFolder", "destpath/YourFileOrFolder"); } }
using UnityEngine; using UnityEditor;
public class CopyFile : MonoBehaviour { [MenuItem("Example/Copy Something")] static void CopySomething() { FileUtil.CopyFileOrDirectory("sourcepath/YourFileOrFolder", "destpath/YourFileOrFolder"); } }