unity3d 屏幕截图多种写法
来源:互联网 发布:skype回拨软件 编辑:程序博客网 时间:2024/06/10 02:15
function OnGUI(){ if(GUI.Button(Rect(Screen.width*0.5-50,Screen.height*0.5-50,100,100),“screen”)){ Application.CaptureScreenshot(“Screenshot.png”); } } 【c#】 using UnityEngine; using System.Collections; public class example : MonoBehaviour { void OnMouseDown() { Application.CaptureScreenshot(“Screenshot.png”); } } function OnGUI(){ if(GUI.Button(Rect(Screen.width*0.5-50,Screen.height*0.5-50,100,100),“screen”)){ Application.CaptureScreenshot(“Screenshot.png”); } } 这张Screenshot.png图片被存在了当前工程的子目录下了。 =========================================================== 另外的方法 function ScreenshotEncode() { // wait for graphics to render yield WaitForEndOfFrame(); // create a texture to pass to encoding var texture:Texture2D = new Texture2D (Screen.width, Screen.height, TextureFormat.RGB24, false); // put buffer into texture texture.ReadPixels(Rect(0.0, 0.0, Screen.width, Screen.height), 0.0, 0.0); texture.Apply(); // split the process up–ReadPixels() and the GetPixels() call inside of the encoder are both pretty heavy yield; // create our encoder for this texture var encoder:JPGEncoder = new JPGEncoder(texture, 75.0); // encoder is threaded; wait for it to finish while(!encoder.isDone) yield; // save our test image (could also upload to WWW) File.WriteAllBytes(Application.dataPath + “/../testscreen-” + count + “.jpg”, encoder.GetBytes()); count++; } //简便方法看下面: function OnMouseDown() { Application.CaptureScreenshot(“Screenshot.png”); }
0 0
- unity3d 屏幕截图多种写法
- unity3d 屏幕截图多种写法
- unity3d 屏幕截图多种写法
- unity3d屏幕截图功能
- unity3d 屏幕截图
- Unity3D-屏幕截图
- Unity3d屏幕截图方法
- unity3d 屏幕截图 核心代码
- Unity3D游戏开发之“屏幕截图”
- 屏幕截图
- 屏幕截图
- 屏幕截图
- 屏幕截图
- 屏幕截图
- 屏幕截图
- 屏幕截图
- 屏幕截图
- 屏幕截图
- ubuntu12.04 + fuerte ROS下安装xtion pro live 显示图像
- HDU 5017 Ellipsoid(模拟退火)
- sqlite3 数据库命令操作
- 几个ie6样式兼容性:1px高的块容器、PNG透明图像、负边距时后遮盖前、边框不显示等问题
- Hibernate、MyBatis的比较
- unity3d 屏幕截图多种写法
- John Carmack密码:0x5f3759df
- TM1628
- 《深入理解Java虚拟机》读书笔记——内存分配与回收策略
- 暑假-最短路(Bellman-ford、spfa)-F - Wormholes
- "超时时间已到。在操作完成之前超时时间已过或服务器未响应"的解决方法
- UNIX网络编程卷一:第二十六章 线程
- 队列Queue
- Apache配置反向代理、负载均衡和集群(mod_proxy方式)