Unity中更改文件夹名

版权声明:转载请注明出处,有流量大家一起分享嘛,哈哈哈哈哈哈哈哈~ https://blog.csdn.net/qq_25325511/article/details/50418396

其实是调用系统类修改文件名和文件夹名。。。。

using UnityEngine;
using System.Collections;
using System.IO;

public class MovetoFileName : MonoBehaviour {
string srcFileName = @”D:/virtual mirror/a”;
string destFileName = @”D:/virtual mirror/b”;

string srcFolderPath = @"D:/virtual mirror/1.txt";
string destFolderPath = @"D:/virtual mirror/2.txt";
// Use this for initialization
void Start () {

}

// Update is called once per frame
void Update () {
if (Input.GetKey (KeyCode.Q))
    {
        System.IO.File.Move(srcFileName, destFileName);
    }
    if (Input.GetKey (KeyCode.W)) 
    {
        System.IO.Directory.Move(srcFolderPath, destFolderPath);

            }
      }
     }

没有更多推荐了,返回首页