Version: 5.3 (switch to 5.4b)
  • C#
  • JS

Script language

Select your preferred scripting language. All code snippets will be displayed in this language.


Suggest a change


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.


Submission failed

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



Switch to Manual


플레이어가 일시정지(pauses)됐을때 모든 게임오브젝트들로 보냅니다.

OnApplicationPause 는 함수에서 yield statement를 사용함으로써 간단히 코루틴이 될수 있습니다. 만약 코루틴으로 구현될 경우, 최초 프레임동안 두번 평가될 것입니다: 첫번째는 조기 통보, 두번째는 일반 코루틴 업데이트 스텝에서.

On Android, when the on-screen keyboard is enabled, it will cause OnApplicationFocus( false ) event. Also, if you press "home" at the moment the keyboard is enabled, the OnApplicationFocus() event won't get called, but OnApplicationPause() will be called instead.

using UnityEngine;

public class AppPaused : MonoBehaviour { bool isPaused = false;

void OnGUI( ) { if( isPaused ) GUI.Label( new Rect( 100, 100, 50, 30 ), "Game paused" ); }

void OnApplicationFocus( bool focusStatus ) { isPaused = focusStatus; }

void OnApplicationPause( bool pauseStatus ) { isPaused = pauseStatus; } }