Unity3D Tutorial : Application Class Part1 - runInBackground
Unity3D 2012. 6. 13. 14:09http://file:///Applications/Unity/Documentation/ScriptReference/Application-runInBackground.html
기본 false (어플리케이션이 백그라운드로 갔을떄 모든 실행을 멈춘다) 포커스가
static var runInBackground : boolean
Description
Should the player be running when the application is in the background?
Default is false (application pauses when it is in background).
http://www.youtube.com/watch?v=BB6srB4tDTk&feature=BFa&list=PL5072DB212534A13D
백그라운드에서도 어플리케이션이 돌아가야 할 경우 true값으로 준다.(기본false)
using UnityEngine;
using System.Collections;
public class ApplicationClassDemo : MonoBehaviour {
private int counter;
private float delay;
private bool tick;
public void Awake() {
print("Awake");
Application.runInBackground = true;
}
// Use this for initialization
public void Start () {
print("Start");
counter = 0;
delay = 1.0f;
tick = false;
}
// Update is called once per frame
public void Update () {
print("Update");
if(!tick)
StartCoroutine("Pause");
}
public void OnGUI() {
print("Update");
GUI.Label(new Rect(10, 10, 100, 20), counter.ToString());
}
private IEnumerator Pause() {
print("Pause");
tick = true;
yield return new WaitForSeconds(delay);
counter++;
tick = false;
}
}
'Unity3D' 카테고리의 다른 글
Unity3d Tutorial : Application Class Part 3 - platform (0) | 2012.06.13 |
---|---|
Unity3d Tutorial: Application Class Part 3 - isEditor (0) | 2012.06.13 |
Unity3d Tutorial - Player Movement 2.0 (0) | 2012.06.12 |
길이로 총 프레임구하기 (0) | 2011.10.05 |
두점사이의 거리 구하기 (0) | 2011.09.16 |