diff --git a/Source/Engine/Engine/Engine.cpp b/Source/Engine/Engine/Engine.cpp index abebbdb91..c9d4bc5ae 100644 --- a/Source/Engine/Engine/Engine.cpp +++ b/Source/Engine/Engine/Engine.cpp @@ -60,6 +60,7 @@ namespace EngineImpl DateTime Engine::StartupTime; bool Engine::HasFocus = false; +uint64 Engine::UpdateCount = 0; uint64 Engine::FrameCount = 0; Action Engine::FixedUpdate; Action Engine::Update; @@ -296,6 +297,8 @@ void Engine::OnUpdate() { PROFILE_CPU_NAMED("Update"); + UpdateCount++; + // Update application (will gather data and other platform related events) { PROFILE_CPU_NAMED("Platform.Tick"); diff --git a/Source/Engine/Engine/Engine.h b/Source/Engine/Engine/Engine.h index f74fcab4b..15285a07e 100644 --- a/Source/Engine/Engine/Engine.h +++ b/Source/Engine/Engine/Engine.h @@ -28,7 +28,12 @@ public: API_FIELD(ReadOnly) static bool HasFocus; /// - /// Gets the current frame count since the start of the game. + /// Gets the current update counter since the start of the game. + /// + API_FIELD(ReadOnly) static uint64 UpdateCount; + + /// + /// Gets the current frame (drawing) count since the start of the game. /// API_FIELD(ReadOnly) static uint64 FrameCount; diff --git a/Source/Engine/Level/Actors/AnimatedModel.cpp b/Source/Engine/Level/Actors/AnimatedModel.cpp index 6f8137bc6..fbc434099 100644 --- a/Source/Engine/Level/Actors/AnimatedModel.cpp +++ b/Source/Engine/Level/Actors/AnimatedModel.cpp @@ -55,10 +55,10 @@ void AnimatedModel::UpdateAnimation() || !IsActiveInHierarchy() || SkinnedModel == nullptr || !SkinnedModel->IsLoaded() - || _lastUpdateFrame == Engine::FrameCount + || _lastUpdateFrame == Engine::UpdateCount || _masterPose) return; - _lastUpdateFrame = Engine::FrameCount; + _lastUpdateFrame = Engine::UpdateCount; if (AnimationGraph && AnimationGraph->IsLoaded() && AnimationGraph->Graph.IsReady()) { diff --git a/Source/Engine/Particles/ParticleEffect.cpp b/Source/Engine/Particles/ParticleEffect.cpp index a5fd4cd02..6c584d513 100644 --- a/Source/Engine/Particles/ParticleEffect.cpp +++ b/Source/Engine/Particles/ParticleEffect.cpp @@ -270,11 +270,11 @@ void ParticleEffect::UpdateSimulation(bool singleFrame) if (!IsActiveInHierarchy() || ParticleSystem == nullptr || !ParticleSystem->IsLoaded() - || _lastUpdateFrame == Engine::FrameCount) + || _lastUpdateFrame == Engine::UpdateCount) return; // Request update - _lastUpdateFrame = Engine::FrameCount; + _lastUpdateFrame = Engine::UpdateCount; _lastMinDstSqr = MAX_Real; if (singleFrame) Instance.LastUpdateTime = (UseTimeScale ? Time::Update.Time : Time::Update.UnscaledTime).GetTotalSeconds(); @@ -371,7 +371,7 @@ void ParticleEffect::Sync() SceneRenderTask* ParticleEffect::GetRenderTask() const { - const uint64 minFrame = Engine::FrameCount - 2; + const uint64 minFrame = Engine::UpdateCount - 2; // Custom task const auto customViewRenderTask = CustomViewRenderTask.Get();