Unity高像素截图

本文章由cartzhang编写,转载请注明出处。 所有权利保留。
文章链接:http://blog.csdn.net/cartzhang/article/details/51386272
作者:cartzhang

怎么在Unity中截图呢?
截图还可以设置不同的大小呢?

一、代码

代码:

using UnityEngine;
using System.Collections;

public class CaptureSuperImage : MonoBehaviour
{
    [Header("放大倍数")]
    public int size = 1;
    // Use this for initialization
    void Start () {

    }

    // Update is called once per frame
    void Update ()
    {
        if ( Input.GetKeyDown(KeyCode.F9))
        {
            Application.CaptureScreenshot("Screenshot.png", size);
        }
    }

}

二、Application解释

 //
        // 摘要:
        //     ///
        //     Captures a screenshot at path filename as a PNG file.
        //     ///
        //
        // 参数:
        //   filename:
        //     Pathname to save the screenshot file to.
        //
        //   superSize:
        //     Factor by which to increase resolution.
        [ExcludeFromDocs]
        public static void CaptureScreenshot(string filename);
        //
        // 摘要:
        //     ///
        //     Captures a screenshot at path filename as a PNG file.
        //     ///
        //
        // 参数:
        //   filename:
        //     Pathname to save the screenshot file to.
        //
        //   superSize:
        //     Factor by which to increase resolution.
        [WrapperlessIcall]
        public static void CaptureScreenshot(string filename, [DefaultValue("0")] int superSize);

我们使用的是最后一个,可以根据游戏窗口大小来生产窗口倍数不同的图片。
怎么使用:
一图胜千言
这里写图片描述

三、截图

最后的截图放上一张:

截图

——————–THE—————END—————

若有问题,请随时联系!!
非常感谢!!

好好珍惜,你所怀念的美好,也就是曾经的现在!!!
哈哈

转载于:https://www.cnblogs.com/qitian1/p/6461910.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值