unity3d 屏幕截图多种写法
来源:互联网 发布:重庆邮电大学人工智能 编辑:程序博客网 时间:2024/05/19 22:49
http://game.ceeger.com/Script/Application/Application.CaptureScreenshot.html
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”);
}
- unity3d 屏幕截图多种写法
- unity3d 屏幕截图多种写法
- unity3d 屏幕截图多种写法
- unity3d屏幕截图功能
- unity3d 屏幕截图
- Unity3D-屏幕截图
- Unity3d屏幕截图方法
- unity3d 屏幕截图 核心代码
- Unity3D游戏开发之“屏幕截图”
- 屏幕截图
- 屏幕截图
- 屏幕截图
- 屏幕截图
- 屏幕截图
- 屏幕截图
- 屏幕截图
- 屏幕截图
- 屏幕截图
- Memcache查看运行状况
- iOS如何添加图片资源以及设置应用程序图标
- View和ViewGroup
- 《C++程序设计语言》笔记之六
- Spring学习笔记2——高级特性 .
- unity3d 屏幕截图多种写法
- 整合Struts2+JasperReport Web报表应用示例
- unity3d webplayer 截图实现
- 云计算还有哪些隐性成本?
- UML总结(对九种图的认识和如何使用Rational Rose 画图)
- Android Launcher——ui框架
- Error number: 20598 The row was not found at the Subscriber when applying the replicated command.
- ASP.Net中RadDatePicker控件对选中时间的判断
- tcgetattr函数的说明