From ae9ded504d94c393aaf5ab207b2b49dad7fcea7c Mon Sep 17 00:00:00 2001 From: Chandler Cox Date: Fri, 23 May 2025 23:21:45 -0500 Subject: [PATCH] Add utility for if in play mode that returns true for shipped applications. --- Source/Engine/Engine/Engine.cpp | 9 +++++++++ Source/Engine/Engine/Engine.h | 5 +++++ 2 files changed, 14 insertions(+) diff --git a/Source/Engine/Engine/Engine.cpp b/Source/Engine/Engine/Engine.cpp index 385a05554..fba8b5f18 100644 --- a/Source/Engine/Engine/Engine.cpp +++ b/Source/Engine/Engine/Engine.cpp @@ -442,6 +442,15 @@ bool Engine::IsEditor() #endif } +bool Engine::IsPlayMode() +{ +#if USE_EDITOR + return Editor::IsPlayMode; +#else + return true; +#endif +} + int32 Engine::GetFramesPerSecond() { return EngineImpl::Fps; diff --git a/Source/Engine/Engine/Engine.h b/Source/Engine/Engine/Engine.h index e8b6fef2c..1af16a930 100644 --- a/Source/Engine/Engine/Engine.h +++ b/Source/Engine/Engine/Engine.h @@ -178,6 +178,11 @@ public: /// API_PROPERTY() static bool IsEditor(); + /// + /// Returns whether the editor is in play mode or will always return true in a shipped applications. + /// + API_PROPERTY() static bool IsPlayMode(); + /// /// Gets the amount of frames rendered during last second known as Frames Per Second. User scripts updates or fixed updates for physics may run at a different frequency than scene rendering. Use this property to get an accurate amount of frames rendered during the last second. ///