当前位置: 首页 > news >正文

中工信融做网站怎么样短链接转换

中工信融做网站怎么样,短链接转换,网页设计页面设计,商标注册网上缴费今天遇到的需求要从Uinty里调用选择程序外的图片#xff0c;类似手机环境下拿图库的照片一样。 效果如下: 话不多说 直接上代码#xff01; 1.编辑器模式下 using System.Collections; using System.Collections.Generic; using UnityEngine; using System.IO; using Syst…今天遇到的需求要从Uinty里调用选择程序外的图片类似手机环境下拿图库的照片一样。 效果如下: 话不多说 直接上代码 1.编辑器模式下 using System.Collections; using System.Collections.Generic; using UnityEngine; using System.IO; using System.Runtime.InteropServices; //using System.Windows.Input; //using System.Windows.Forms; using System; using UnityEngine.UI;public class TestImage : MonoBehaviour {public RawImage rawImage;// 引用一个Unity的Texture2D来显示加载的图片public Texture2D texture;// 在Unity中点击按钮调用此方法public void LoadImage(){// 打开文件对话框并等待用户选择文件string filePath UnityEditor.EditorUtility.OpenFilePanel(Select PNG, , png);// 检查用户是否选择了文件if (!string.IsNullOrEmpty(filePath)){try{ImageProcessor._instance.inputImagePath filePath;// 读取PNG文件为字节数组byte[] fileData File.ReadAllBytes(filePath);// 创建一个新的Texture2Dtexture new Texture2D(2, 2);// 加载PNG文件数据到Texture2Dtexture.LoadImage(fileData);// 将加载的图片显示在RawImage对象上rawImage.texture texture;}catch (System.Exception ex){// 处理异常情况Debug.LogError(Error loading image: ex.Message);}}} } 2.打包后运行模式下 由于 UnityEditor.EditorUtility.OpenFilePanel 只支持在编辑器模式下打包会报错。 所以这边需要使用跨平台的第三方库如StandaloneFileBrowser这是一个可以在游戏运行时使用的开源库支持Windows、Mac和Linux平台的文件选择对话框。 链接如下 Unity 独立文件浏览器 Github地址 下载之后导入Unity就可以啦~~~ using System.Collections; using System.Collections.Generic; using UnityEngine; using System.IO; using UnityEngine.UI; // 引入StandaloneFileBrowser using SFB;public class TestImage : MonoBehaviour {public RawImage rawImage;// 引用一个Unity的Texture2D来显示加载的图片public Texture2D texture;// 在Unity中点击按钮调用此方法public void LoadImage(){// 使用StandaloneFileBrowser打开文件对话框string[] paths StandaloneFileBrowser.OpenFilePanel(Select PNG, , png, false);if (paths.Length 0){string filePath paths[0];if (!string.IsNullOrEmpty(filePath)){try{// 读取PNG文件为字节数组byte[] fileData File.ReadAllBytes(filePath);// 创建一个新的Texture2Dtexture new Texture2D(2, 2);// 加载PNG文件数据到Texture2Dtexture.LoadImage(fileData);// 将加载的图片显示在RawImage对象上rawImage.texture texture;}catch (System.Exception ex){// 处理异常情况Debug.LogError(Error loading image: ex.Message);}}}} }
http://www.pierceye.com/news/549974/

相关文章:

  • 如何做问卷调查网站济南网络公司
  • 纯js做网站Wordpress税
  • 建云科技网站首页阿里云 wordpress 安装
  • 浙江省建设工程协会网站动漫网站的设计与实现
  • wordpress能导出网站吗企业内部网站开发
  • 景观石网站建设方案一 网站开发背景
  • 开发app的平台外贸seo建站
  • 网站界面设计实训报告深圳设计公司办公室
  • 京东网站的公司地址别人网站建设多少钱
  • 如何加快网站打开速度wordpress注册怎样通过邮箱验证码
  • 有关图书网站建设策划书电脑公司网站系统源码
  • 西班牙网站后缀360收录提交入口网址
  • 济宁网站建设工程教育网官网学员登录
  • html5导航网站源码下载wordpress 调用 discuz
  • 住房和城乡建设部网站 投诉有哪些网站可以学做糕点的
  • 电商购物网站m3u8插件 wordpress
  • 河北手机网站制作多少钱wordpress文章头部
  • 悠悠我心的个人网站素材网站建设教育培训
  • 网站建设定金做什么会计分录湘潭有实力的关键词优化公司
  • 网站备案 网站建设方案书云搜索app
  • 青岛网络推广建站民营医院建设网站
  • 罗湖住房和建设局网站wordpress调用内容代码
  • 网络logo设计优化设计七年级下册语文答案
  • 贵港网站seo安新网站建设
  • 网站怎么自己编辑模块创意网名大全
  • php的网站架构建设框架wordpress如何运行
  • 广州seo网站排名优化数码设计网站
  • 免费做视频相册的网站网站建设的功能描述
  • 网站建设方案浩森宇特alexa排名是什么意思
  • 网上手机网站建设计划书百度小说风云榜排名