unity从右到左显示图片_Unity 截取图片并且显示出来

Unity 截取图片并且显示出来

近期用到了unity的截图,并且把他显示出来,摸索了很多!

讲解一个东西,android可以存储一些文件在本地,比如配置文件等!

对于不同的系统,方法不一!

if (Application.platform == RuntimePlatform.Android || Application.platform == RuntimePlatform.IPhonePlayer)//安卓和IOS

imagePath = Application.persistentDataPath;

else if (Application.platform == RuntimePlatform.WindowsPlayer)//EXE的

imagePath = Application.dataPath;

else if (Application.platform == RuntimePlatform.WindowsEditor)

{

imagePath = Application.dataPath;

imagePath = imagePath.Replace("/Assets", null);

}

注意截图命令 Application.CaptureScreenshot("1.jpg");这个会自动存储到相应

系统的路径中去,也就是上面说的路径!

IEnumerator SetTexture()

{

WWW w = new WWW("file://"+imagePath);//注意必须加file://否则失败

yield return w;

if (w.isDone)

{

obj.renderer.material.mainTexture=w.texture;

}

message = w.error.ToString();

}

疑问,我接上了手机却搜索不到1.jpg他跑到哪儿去了呢?

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值