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.

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

using UnityEngine;
using System.Collections;

public class example : MonoBehaviour {
void Awake() {
if (Application.isPlaying)
print("In player or playmode");

}
}

import UnityEngine
import System.Collections

class example(MonoBehaviour):

def Awake():
if Application.isPlaying:
print('In player or playmode')