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.

在Unity编辑器中,如果处于播放模式时返回真。

using UnityEngine;
using System.Collections;

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

	}
}
if ( Application.isPlaying ) {
   print("In player or playmode");
}
Page last updated: 2010-12-14