Unity 6.3
0 онлайн 70 гостей 3 в системе
Вход

EditorApplication.isPlaying

Declaration

public static bool isPlaying;

Описание

Находится ли редактор в режиме воспроизведения.

Возвращает true, если Редактор находится в режиме воспроизведения. Установка isPlaying задерживает результат до тех пор, пока не будет завершен весь код скрипта для этого кадра. Это также возвращает true, если Редактор приостановлен.

Дополнительные ресурсы: isPaused, isPlayingOrWillChangePlaymode.

using UnityEngine;
using UnityEditor;

// The following is a simple example where EditorApplication.isPlaying is watched to // report whether the Editor is in Play mode.

public class EditorPlaying : EditorWindow { [MenuItem("Examples/EditorApplication.isPlaying demo")] static void Init() { EditorWindow window = GetWindow(typeof(EditorPlaying)); window.position = new Rect(100, 100, 150, 50); window.Show(); }

void OnGUI() { if (EditorApplication.isPlaying) { EditorGUILayout.LabelField("Playing"); } else { EditorGUILayout.LabelField("Not playing"); } } }