diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..f215631 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +# Visual Studio cache directory +.vs/ diff --git a/README.md b/README.md index 9e14a18..88d2211 100644 --- a/README.md +++ b/README.md @@ -69,7 +69,7 @@ Custom profilers can be added to the bottom of the Visual Profiler by adding to ## Sample -A sample Unity project can be found in the *VisualProfilerUnityProject* folder. This project contains a simple sample scene that demonstrates the visual profiler being used in 3D and 2D (perspective and orthographic cameras) plus example profiler groups for C# behaviors, rendering, and physics. +A sample Unity project can be found in the *VisualProfilerUnityProject* folder. This project contains a simple sample scene that demonstrates the Visual Profiler being used in 3D and 2D (perspective and orthographic cameras) plus example profiler groups for C# behaviors, rendering, and physics. ![Sample](README/Images/Sample.png) diff --git a/com.microsoft.mixedreality.visualprofiler/VisualProfiler.cs b/com.microsoft.mixedreality.visualprofiler/VisualProfiler.cs index 7463a52..63d165f 100644 --- a/com.microsoft.mixedreality.visualprofiler/VisualProfiler.cs +++ b/com.microsoft.mixedreality.visualprofiler/VisualProfiler.cs @@ -602,6 +602,7 @@ namespace Microsoft.MixedReality.Profiling private bool instanceColorsDirty = false; private bool instanceBaseColorsDirty = false; private bool instanceUVOffsetScaleXDirty = false; + private bool customUpdateInUse = false; /// /// Reset any stats the profiler is tracking. Call this if you would like to restart tracking @@ -622,6 +623,19 @@ namespace Microsoft.MixedReality.Profiling limitMemoryUsage = 0; } + /// + /// Allows for an app to specific a custom point in the frame to call update. (Should be called once every frame.) + /// + public void CustomUpdate() + { + customUpdateInUse = true; + + if (isActiveAndEnabled) + { + InternalUpdate(); + } + } + private void OnEnable() { if (material == null) @@ -725,6 +739,14 @@ namespace Microsoft.MixedReality.Profiling private void LateUpdate() { + if (customUpdateInUse == false) + { + InternalUpdate(); + } + } + + private void InternalUpdate() + { #if ENABLE_PROFILER foreach (var profilerGroup in ProfilerGroups) { diff --git a/com.microsoft.mixedreality.visualprofiler/VisualProfiler.cs.meta b/com.microsoft.mixedreality.visualprofiler/VisualProfiler.cs.meta index 3ab062e..d79244a 100644 --- a/com.microsoft.mixedreality.visualprofiler/VisualProfiler.cs.meta +++ b/com.microsoft.mixedreality.visualprofiler/VisualProfiler.cs.meta @@ -5,7 +5,7 @@ MonoImporter: serializedVersion: 2 defaultReferences: - material: {fileID: 2100000, guid: b98f8349d37aef742baaa038e99837c0, type: 2} - executionOrder: 1000 + executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: diff --git a/com.microsoft.mixedreality.visualprofiler/package.json b/com.microsoft.mixedreality.visualprofiler/package.json index 0153172..054ae55 100644 --- a/com.microsoft.mixedreality.visualprofiler/package.json +++ b/com.microsoft.mixedreality.visualprofiler/package.json @@ -1,6 +1,6 @@ { "name": "com.microsoft.mixedreality.visualprofiler", - "version": "3.6.0", + "version": "3.7.0", "displayName": "Microsoft Mixed Reality Visual Profiler", "description": "Provides a drop in solution for viewing your mixed reality Unity application's frame rate, scene complexity, and memory usage.", "documentationUrl": "https://github.com/microsoft/VisualProfiler-Unity/blob/main/README.md",