zoukankan      html  css  js  c++  java
  • unity中编辑器直接截屏代码

    using UnityEngine;
    using System.Collections;
    using System.Windows.Forms;
    
    public class screenshots : MonoBehaviour {
    
        public int I = 1;
        // Use this for initialization
        void Start () {
    	
    	}
    	
    	// Update is called once per frame
    	void Update () {
    
    	    if (Input.GetKeyDown(KeyCode.A))
    	    {
    
    	        Screen();
    
    	    }
    
    	}
    
        public void Screen()
        {
            SaveFileDialog saveLog = new SaveFileDialog();
            saveLog.InitialDirectory = "c:\";
            saveLog.Filter = "Image File(*.JPG;*.BMP;*.PNG)|*.JPG;*.BMP;*.PNG|All files(*.*)|*.*";
            DialogResult result = saveLog.ShowDialog();
            if (result == DialogResult.OK)
            {
                string path = saveLog.FileName;
                UnityEngine.Application.CaptureScreenshot(path, I);
    
            }
        }
    }
    

    需要导入插件:System.Windows.Forms

  • 相关阅读:
    为服务部署 Jekins的使用
    spring cloud
    docker
    WebSocket
    idea
    maven
    SQL四种语言(DDL、 DML、 DCL、 TCL)
    十大经典排序
    AVL树的旋转图解和简单实现
    多个线程交替打印
  • 原文地址:https://www.cnblogs.com/Study088/p/10098186.html
Copyright © 2011-2022 走看看