Unity技术分享之Unity电脑端本地化支持,打开系统文件选择框支持Windows&Mac系统

1️⃣. Unity本地化支持打开系统文件选择框 ;
2️⃣. 同时支持Mac端和Windows端 ;

3️⃣. 下一步计划实现安卓和苹果端的本地文件管理功能 , 大家支持下吧 ?


很简单,使用我提供的插件:
- 支持Windows
- 支持Mac
- 支持多选
- 支持选定文件类型
- 支持选定文件夹
- 支持打开窗口名称定义

1. 图示 ↓

Windows下演示
Mac下演示

2. 使用代码部分展示 ↓

		/// <summary>
        /// 获取文件路径实例
        /// </summary>
        /// <returns>The file path.</returns>
    private string[] GetFilePath()
        {
            string[] path = { null };
            string[] strs = StandaloneFileBrowser.OpenFilePanel("打开用户数据文件", "%HOMEDRIVE/Desktop%", "", false);
            if (Application.platform == RuntimePlatform.WindowsPlayer || Application.platform == RuntimePlatform.WindowsEditor)
            {
                if (strs.Length > 0)
                {
                    path = strs;
                }
                else
                {
                    Debug.Log("用户取消选择");
                }
            }
            else if (Application.platform == RuntimePlatform.OSXPlayer || Application.platform == RuntimePlatform.OSXEditor)
            {
                if (strs.Length > 0)
                {
                    path = strs;
                }
                else
                {
                    Debug.Log("用户取消选择");
                }
            }
            return path;
        }

3. 插件下载 ↓

https://download.csdn.net/download/s15100007883/10406823

发布了31 篇原创文章 · 获赞 14 · 访问量 4万+

猜你喜欢

转载自blog.csdn.net/s15100007883/article/details/79997989
今日推荐