Custom data
This page is for when a ready-made card is not enough. You can build a card from a provider that has no prefab, or you can feed in a number from your own game.
A card is always two parts on one child of the performance window: a provider that measures the number, and a renderer that draws it. The Add a number page lists the providers that already exist, and the Performance graphs page explains the renderer settings.
Build a card from a provider
Use these steps for a built-in provider that has no prefab, such as Unity Profiler or GameObject Tag Count. The same steps work for any other provider script in the tool.
- Create an empty child under the performance window and name it after the number, so the Hierarchy stays easy to read.
- Add the provider script to that child. This part measures the number.
- Add one renderer to the same child. Rated Graph Renderer is a good default when you care about good, warning, and bad. Colored Graph Renderer is a good default when you only want a simple chart.
Press play, and the window picks up the new child and draws the card.
For Unity Profiler, choose a Profiler Category and a Profiler Status on the provider. That picks the Unity counter to read.
For GameObject Tag Count, set Tag to the tag you want to count. Spawned enemies and bullets are typical uses.
Some numbers only work on certain devices. On the others, the performance window hides that card instead of showing an empty graph.
Fetch Interval, History Size, and Store Values in CSV File are on the provider. The Performance graphs page explains those settings.
Your own number
You can feed in any number from your game, such as the player count, a custom timer, or the size of a queue.
Open the script FpsProvider in the project and use it as your template. You do not need a new rendering system. A provider only needs three things:
- A name, so the card and the legend can label it.
- A unit, such as
ms,fps, or whatever word fits your number. Use an empty unit if the number is a plain count. - The next number to show.
FpsProviderworks this out on each update, and your script should do the same for your own value.
Put your script on a child of the performance window and add a renderer on that same child. Set Scale Values and Rendering Pattern on the renderer if the number needs it.
If the number should turn yellow and red, use Rated Graph Renderer and set the limits for each platform. If you only want to watch it, use Colored Graph Renderer.
Turn on Store Values in CSV File on the provider when you want those samples in a spreadsheet after the session.