zoukankan      html  css  js  c++  java
  • 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—————

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

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

  • 相关阅读:
    Java的格式化输出
    常用排序算法的Python实现
    零基础自学用Python 3开发网络爬虫(一)
    Python常见数据结构整理
    百度天气预报API的使用(java版本)
    大总结
    CCS学习(三)
    CSS学习(页外引用还不懂)
    CSS自定义动画
    ssm日期格式转换
  • 原文地址:https://www.cnblogs.com/qitian1/p/6461910.html
Copyright © 2011-2022 走看看