首页 > Unity3D专栏 > 【Unity3D】Unity3D另类录制”视频“
2017
07-25

【Unity3D】Unity3D另类录制”视频“

Unity3D另类录制视频,每帧都截取屏幕的图片,可以用这种形式来录制

当然了。其实还有一个插件可以录制视频

using UnityEngine;

public class ScreenshotMovie : MonoBehaviour
{
    // The folder we place all screenshots inside.
    // If the folder exists we will append numbers to create an empty folder.
    public string folder = "ScreenshotMovieOutput";
    public int frameRate = 25;
    public int sizeMultiplier = 1;
    private string realFolder = "";
  
    void Start()
    {
        // Set the playback framerate!
        // (real time doesn't influence time anymore)
        Time.captureFramerate = frameRate;
  
        // Find a folder that doesn't exist yet by appending numbers!
        realFolder = folder;
        int count = 1;
        while (System.IO.Directory.Exists(realFolder))
        {
            realFolder = folder + count;
            count++;
        }
        // Create the folder
        System.IO.Directory.CreateDirectory(realFolder);
    }
    void Update()
    {
        // name is "realFolder/shot 0005.png"
        var name = string.Format("{0}/shot {1:D04}.png", realFolder, Time.frameCount); 
        // Capture the screenshot
        Application.CaptureScreenshot(name, sizeMultiplier);
    }
}

 

http://download.csdn.net/detail/hackdjh/7591423



虚拟世界提醒您:如果您觉得本文不错,快快将这篇文章分享出去吧 ,感谢您的支持和关注,谢谢!
最后编辑:
作者:虚拟世界
专注互联网技术及资讯 技术研究中心|有相关Unity3D问题或者作事宜请联系我哦!
捐 赠如果您愿意花10块钱请我喝一杯咖啡的话,请用手机扫描二维码即可通过支付宝或者微信直接向我捐款,在此非常感谢您对虚拟世界的捐赠。

留下一个回复

你的email不会被公开。