最近在学习U3D,会写一些脚本工具,操作文件。
比如在unity中打开文本:
var logPath = Application.persistentDataPath+"/log";
var fileName = new DirectoryInfo(logPath).GetFiles().OrderBy(t=>t.LastWriteTime).Last().FullName;//取到文本路径
System.Diagnostics.Process.Start(fileName);//打开文本
也是可以打开网址System.Diagnostics.Process.Start(http://baidu.com);
比如在unity中打开文件夹
var logPath = Application.persistentDataPath + "/log";
System.Diagnostics.Process.Start("explorer.exe",logPath.Replace('/','\\'));//打开文件夹
本文介绍了如何使用Unity进行文件及网址的操作,包括打开文本文件、网页链接以及指定文件夹的方法。通过C#脚本实现了文件路径的获取,并利用System.Diagnostics.Process.Start方法实现不同场景的应用。
685

被折叠的 条评论
为什么被折叠?



