This page is a work in progress and could be pending updates.

FusionStats

Overview

Fusion Stats consists of a set of UI components for monitoring networking telemetry. The FusionStats component is the primary component for generating, initializing and controlling a hierachy of telemetry UI elements.

Fusion Stats 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.

Back To Top

Basic Usage

The add FusionStats to a scene

  • run the Unity Editor menu: Fusion > GameObject > Add Fusion Stats; or,
  • right click on Hierarchy, or a GameObject in the Hierarchy, and select: Fusion > Add Fusion Stats.

Add Fusion Stats
Add Fusion Stats to a GameObject.

  • If a GameObject is selected: FusionStats will default to StatsCanvasType.GameObject, and the stats will render in 3d space attached to that object.
  • If no GameObject is selected: FusionStats will default to StatsCanvasType.Overlay, and stats will render in screen space.

This menu option will also automatically add the FusionStatsBillboard component to the object. The FusionStatsBillboard component will automatically rotate the GameObject toward a camera when FusionStats.CanvasType is set to GameObject.

Back To Top

Runtime Features

Several additional features are available while the simulation is running. This section presents the various "hidden" features one can find in the FusionGraph at runtime.

View Options

Clicking on the title of a FusionGraph will bring up a drop list of the view options for that graph (if more than one are available).

Selecting alternate graph methods.
Selecting alternate graph methods.

Back To Top

Averaging Options

Clicking on a the value field of a FusionGraph at runtime, will cycle through any available averaging options for the current data source.

  • Average per Second;
  • Average per Tick;
  • Average per Sample.

Selecting alternate averaging options.
Selecting alternate averaging options.

Back To Top

Pinging

Clicking the very top of the stats panel on the NetworkRunner name will ping the FusionStats component in the hierarchy. If no GameObject is currently selected, this action will also select the FusionStats component in the inspector.

Pinging FusionStats game object.
Pinging FusionStats game object.

Back To Top

FusionStats Component

FusionStats is the primary root component for all Fusion Stats. It generates child Canvas and UI components, and manages connecting these telemetry components to NetworkRunner and NetworkObject data sources at runtime.

Redraw Interval

Limits the UI updates to never happen more than once per this value. Increasing this value will improve performance.

Back To Top

Layout Section

Layout controls, which generally affect the layout of the FusionStats canvas.

Canvas Types

There are two canvas modes:

  • GameObject will render the canvases in 3d space.
  • Overlay will render the canvas in screen space.

Back To Top

GameObject Rect / Overlay Rect

These two editable rects define where on the UI.Canvas the stats elements will render, allowing the graphs to be rendered on a specific side or corner of the canvas.

When CanvasType is set to GameObject, the GameObjectRect is used, and allows the stats to be offset from the center of the object they are attached to.

When CanvasType is set to Overlay, the OverlayRect is used, and specifies where on the screen the stats will render. FusionGraph components will scale as needed to fill the Rect region.

The Rect can be drawn in the inspector by clicking and dragging over the simulated canvas area, or be modified by grabbing the yellow handles and dragging the corners.

Be sure to expand the Rect drawer if you wish to drag the corners.

Collapsed GameObject Rect
Collapsed Normalized Rect Drawer aligned to upper right corner.

GameObject Rect
Expanded Normalized Rect Drawer, aligned to upper right corner.

GameObject Stats
Stats accordingly constrainted to the upper right corner of canvas.

Back To Top

Fusion Graphs Layout Section

Layout controls which specifically affect the layout of FusionGraph components (the bottom section of the Fusion Stats canvas).

Default Layout

Any child FusionGraph components will use this Layout setting if their individual setting is set to auto. When set to Auto, a layout is chosen based on the current width/height of each graph.

Back To Top

No Text Overlap

This setting ensures no Fusion Graph layout options are used where a graphs UI. Text will overlap its graph shader (the vertical telemetry bars). Use this in any use cases where the text appears garbled. Typically this will be any case where the canvas is not perfectly billboarding to face the camera, such as with VR.

Back To Top

Graph Column Count

The graph column count can be set manually with the FusionStats.GraphColumnCount setting. When setting the FusionStats.GraphColumnCount to 0, the FusionStats.GraphMaxWidth value will be used to automatically create new columns when the canvas width exceeds that value.

Back To Top

Graph Max Width

The maximum width to which a FusionGraph element will expand. Once expanded beyond this width, new columns will be added as needed.

Back To Top

Network Object Stats Section

Options specific to a root NetworkObject component. These are only valid when FusionStats is added to a GameObject with a NetworkObject.

Back To Top

Enable Object Stats

Enables usages UI elements and telemetry handling for a root NetworkObject component.

Back To Top

Object Title Height

Height of the label area for the GameObject name.

Back To Top

Object Ids Height

Height of the section which shows the NetworkObject ID and player authorities.

Back To Top

Object Meters Height

Height of the horizontal meter bar section.

Back To Top

Data Section

Options for which data sources will be used, and which telemetry will be displayed.

Runner

All telemetry data requires a NetworkRunner association. This will automatically be found when Network Runners start.

Back To Top

Connect To

There may be more than one runner when in Multi-Peer mode, so you may want to control which runner type is found (there may be more than one runner when in Multi-Peer mode). These SimulationModes flags in conjunction with FusionStats.EnforceSingle ensure that only one instance of this FusionStats will exist, regardless of how many Peers are running.

Back To Top

Included Stats

Each telemetry item can be included or excluded from the rendered FusionGraph set. Available telemetry data comes from three parts of the engine, and are grouped accordingly.

  • Net Stats: Network transport layer statistics, such as Round Trip Time (rtt) and incoming/outgoing data totals.
  • Sim Stats: Simulation and NetworkRunner statistics, such as Resimulation Count, Snapshot sizes, and interpolation/prediction specifics.
  • Obj Stats: NetworkObject specific telemetry such as RPC counts, and bandwidth used by Networked state values.

Back To Top

Life-Cycle Section

Options which affect singleton and self-destruction of FusionStats GameObject instances.

Auto Destroy

When true, the FusionStats GameObject will be destroyed when its associated NetworkRunner becomes disconnected.

Back To Top

Enforce Single

When true, will destroy repeat GameObject instances of NetworkStats which have the same FusionStats.GUID. This is useful in Multi-Peer mode, when only one instance of a FusionStats object should exist, rather than one for each Peer. Use this in combination with FusionStats.ConnectTo to control which peer type should be monitored.

Back To Top

GUID

Used with FusionStats.EnforceSingle to identify multiple instances of the same Stats object in Multi-Peer mode.

To Document Top