言語: 日本語
  • C#
  • JS
  • Boo

スクリプト言語

お好みのスクリプト言語を選択すると、サンプルコードがその言語で表示されます。

EditorApplication.timeSinceStartup

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Sumbission failed

For some reason your suggested change could not be submitted. Please try again in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

public static var timeSinceStartup: double;
public static double timeSinceStartup;
public static timeSinceStartup as double

Description

エディタが起動してからの時間 (Read Only)

このプロパティは秒単位でエディタが起動してからの時間を含んでいます。 Time.realtimeSinceStartupとは異なり、これは再生モードが変更されるたびにリセットされません。 See Also: Time.realtimeSinceStartup
300秒毎に現在のシーンを保存するシンプルなエディターウィンドウ

	// Simple editor window that autosaves the working scene
	// Make sure to have this window opened to be able to execute the auto save.
	
	import UnityEditor;
	
	class SimpleAutoSave extends EditorWindow {
		
		var saveTime : float = 300;
		var nextSave : float = 0;
	
		@MenuItem("Example/Simple autoSave")
		static function Init() {
			var window : SimpleAutoSave = 
				EditorWindow.GetWindowWithRect(
					SimpleAutoSave, 
					Rect(0,0,165,40));
			window.Show();
		}
		function OnGUI() {
			 EditorGUILayout.LabelField("Save Each:", saveTime + " Secs");
			 var timeToSave : int = nextSave - EditorApplication.timeSinceStartup;
			 EditorGUILayout.LabelField("Next Save:", timeToSave.ToString() + " Sec");
			 this.Repaint();
			 
			if(EditorApplication.timeSinceStartup > nextSave) {
				var path : String [] = EditorApplication.currentScene.Split(char.Parse("/"));
				path[path.Length -1] = "AutoSave_" + path[path.Length-1];	
				EditorApplication.SaveScene(String.Join("/",path));
				Debug.Log("Saved Scene");
				nextSave = EditorApplication.timeSinceStartup + saveTime;
			}
		}
	}