Application.isPlaying Manual     Reference     Scripting  
Scripting > Runtime Classes > Application
Application.isPlaying

static var isPlaying : bool

Description

Returns true when in any kind of player (Read Only).

Returns true in the Unity editor when in play mode.

if (Application.isPlaying)
{
print("In player or playmode");
}