diff --git a/Source/Engine/Streaming/Streaming.cpp b/Source/Engine/Streaming/Streaming.cpp
index 04bfa1df2..a5cb65eee 100644
--- a/Source/Engine/Streaming/Streaming.cpp
+++ b/Source/Engine/Streaming/Streaming.cpp
@@ -251,6 +251,20 @@ void StreamingSystem::Execute(TaskGraph* graph)
graph->DispatchJob(job, 1);
}
+StreamingStats Streaming::GetStats()
+{
+ StreamingStats stats;
+ ResourcesLock.Lock();
+ stats.ResourcesCount = Resources.Count();
+ for (auto e : Resources)
+ {
+ if (e->Streaming.TargetResidency > e->GetCurrentResidency())
+ stats.StreamingResourcesCount++;
+ }
+ ResourcesLock.Unlock();
+ return stats;
+}
+
void Streaming::RequestStreamingUpdate()
{
PROFILE_CPU();
diff --git a/Source/Engine/Streaming/Streaming.h b/Source/Engine/Streaming/Streaming.h
index b164eeb86..988b12fba 100644
--- a/Source/Engine/Streaming/Streaming.h
+++ b/Source/Engine/Streaming/Streaming.h
@@ -8,6 +8,16 @@
class GPUSampler;
+// Streaming service statistics container.
+API_STRUCT() struct FLAXENGINE_API StreamingStats
+{
+DECLARE_SCRIPTING_TYPE_MINIMAL(StreamingStats);
+ // Amount of active streamable resources.
+ API_FIELD() int32 ResourcesCount = 0;
+ // Amount of resources that are during streaming in (target residency is higher that the current). Zero if all resources are streamed in.
+ API_FIELD() int32 StreamingResourcesCount = 0;
+};
+
///
/// The content streaming service.
///
@@ -20,6 +30,11 @@ DECLARE_SCRIPTING_TYPE_NO_SPAWN(Streaming);
///
API_FIELD() static Array> TextureGroups;
+ ///
+ /// Gets streaming statistics.
+ ///
+ API_PROPERTY() static StreamingStats GetStats();
+
///
/// Requests the streaming update for all the loaded resources. Use it to refresh content streaming after changing configuration.
///