This document is about: FUSION 2
SWITCH TO

Fusion Statistics

Overview

Fusion Statistics consists of a set of UI components for monitoring useful Fusion telemetry. The FusionStatistics component is the primary component for generating, initializing and controlling a hierarchy of telemetry UI elements.

Fusion Statistics uses the basic UnityEngine.UI components, which allows stats to be viewed in builds as either a screen overlay or attached to an object in 3D space.

fusion statistics example
Example of the Fusion Statistics in use.

Basic Usage

To get started with the Fusion Statistics:

  • Add the component FusionStatistics on a NetworkRunner object before it was started; or,
  • Add the FusionStatistics on the NetworkRunner after initialization and hit the Setup Statistics Panel button on the editor (it is also possible to call a method with the same name from code).
add fusion statistics
Add Fusion Statistics to a NetworkRunner game object.

After the initialization of the NetworkRunner (or a manual setup using the editor button) a canvas root is instantiated with space for the desired statistics charts to be analyzed. If any stats are selected in the editor dropdown, a chart tracking them will be added automatically, but it is possible to toggle the stats in the dropdown located in the upper left area of the statistics panel.

Note: The FusionStatistics component must be on the same game object as the NetworkRunner, as it will connect to it and collect all the requested stats data.

Statistics Panel Buttons and Usability

fusion statistics panel guide
Fusion Statistics Panel Buttons Guide.

Click and drag any of the panel's top or bottom bars, or any static area such as the background, to move the statistics panel around the screen. If the panel is dropped outside the visible screen area, it will snap back to its original position.

  1. Hide/collapse the body of the statistics panel, leaving only the top header. While it is collapsed, no statistics data is collected and the charts are cleaned up.
  2. Dropdown list to toggle visible statistics charts on the panel. Select an already added stat to remove it.
  3. A label which displays the PlayerRef of the connected NetworkRunner local player. Useful for differentiating statistics panels when using multi-peer.
  4. Button to destroy the statistics panel. The FusionStatistics component is still alive on the `NetworkRunner' object, calling the Setup Statistics Panel method or pressing the editor button again will restore it.
  5. Open a configuration panel to use the world anchor settings.
  6. Restore the statistics panel to its original position.

Statistic Graph

fusion statistics stat graph
Fusion Statistics RTT Stat Graph image.

The image above shows how each stat is displayed on the panel, the graph has some useful information such as a peak value (from values within the buffer), the average value and the last value collected.

Individual stat graph can be collapsed by using the arrow button.

Thresholds

It is possible to see that the chart bar changes colors depending on the value and some labels on the left side. These are the thresholds of the stat, each stat can have 3 custom thresholds that can be defined from code with FusionStatistics.SetStatsCustomConfig() method or from the FusionStatistics component editor, just add a new rule for each stat of choice.

fusion statistics custom config
Fusion Statistics RTT Custom Config.
  • Values bellow threshold 1 are green.
  • Values in between threshold 1 and threshold 2 are yellow.
  • Values in between threshold 2 and threshold 3 are orange.
  • Values above threshold 3 are red.

Network Object Chart

fusion statistics network object stat graph
Fusion Statistics Network Object Stat Graph image.

It is possible to monitor a specific NetworkObject statistics by adding the NetworkObjectStatistics component to it, a blue header for the NetworkObject will appear on the statistics panel.

Use the toggle stats dropdown to add or remove stats to monitor, use the arrow buttons to collapse the entire NetworkObject graph.

World Anchor

fusion statistics world anchor
Fusion Statistics World Anchor Settings Panel.

In VR scenarios, or any other scenario where it is necessary to set the statistics graphs to world position, this can be achieved by using the world anchor settings in the settings panel, enable the "Use World Anchor" checkbox to see and select a world anchor.

Add the StatisticsWorldAnchor component to any GameObject and it will appear as a world anchor candidate, click on the GameObject name and the statistics panel will be re-parented to that object.

fusion statistics world anchor demo
Fusion Statistics World Anchor Demonstration.

The statistics panel canvas will follow the GameObject position, if the object is destroyed the canvas will snap back to the original position. Uncheck the "Use World Anchor" checkbox to use the canvas in overlay mode again.

Back to top