EditorWindow
- autoRepaintOnSceneChange
- BeginWindows
- Close
- EndWindows
- focusedWindow
- FocusWindowIfItsOpen.<T>
- FocusWindowIfItsOpen
- Focus
- GetWindow.<T>
- GetWindowWithRect.<T>
- GetWindowWithRect
- GetWindow
- mouseOverWindow
- OnDestroy
- OnFocus
- OnGUI
- OnHierarchyChange
- OnInspectorUpdate
- OnLostFocus
- OnProjectChange
- OnSelectionChange
- position
- RemoveNotification
- Repaint
- SendEvent
- ShowAuxWindow
- ShowNotification
- ShowPopup
- ShowTab
- ShowUtility
- Show
- Update
- wantsMouseMove
EditorWindow.Update 更新
function Update () : void
Description描述
Called 100 times per second on all visible windows.
在所有可见的窗口每秒调用100次。
Save frames from the Game View when on play mode.
当播放模式在游戏视图保存帧。
// Simple script that saves frames from the Game View when on play mode
//当播放模式在游戏视图保存帧
// You can put later the frames togheter and create a video.
//可以把之后的帧放在一起,创建一个视频
// Note: The frames are saved next to the Assets folder.
//注意:帧被保存在临近的资源文件夹
using UnityEngine;
using UnityEditor;
public class SimpleRecorder : EditorWindow {
string fileName = "FileName";
string status = "Idle";
string recordButton = "Record";
bool recording = false;
float lastFrameTime = 0.0f;
int capturedFrame = 0;
[MenuItem ("Example/Simple Recorder")]
static void Init () {
SimpleRecorder window =
(SimpleRecorder)EditorWindow.GetWindow(typeof(SimpleRecorder));
}
void OnGUI () {
fileName = EditorGUILayout.TextField ("File Name:", fileName);
if(GUILayout.Button(recordButton)) {
if(recording) { //recording 记录
status = "Idle...";
recordButton = "Record";
recording = false;
} else { // idle 废弃
capturedFrame = 0;
recordButton = "Stop";
recording = true;
}
}
EditorGUILayout.LabelField ("Status: ", status);
}
void Update () {
if (recording) {
if (EditorApplication.isPlaying && !EditorApplication.isPaused){
RecordImages();
Repaint();
} else
status = "Waiting for Editor to Play";
}
}
void RecordImages() {
if(lastFrameTime < Time.time + (1/24f)) { // 24fps
status = "Captured frame " + capturedFrame;
Application.CaptureScreenshot(fileName + " " + capturedFrame + ".png");
capturedFrame++;
lastFrameTime = Time.time;
}
}
}
最后修改:2011年6月20日 Monday 17:19