Proving Ground1.0.0 · Exaweft

Proving Ground user guide

Proving Ground lets you tune gameplay values while the game runs, keep the numbers you like as presets, and record runs so you can compare which settings played best. It works in the Editor's Play Mode and in development builds, and is off in release builds.

  1. Quick start: a working panel in about five minutes
  2. Tuning values with [Tune] and registration
  3. Presets
  4. The F1 panel: hotkeys, layout and [DebugAction] buttons
  5. Diagnostics: Diag.Event, Diag.Count, Diag.Timer, performance and logs
  6. Run records and comparison
  7. Scripted runs
  8. Keeping game input away from the panels
  9. Release builds and performance
  10. What has been tested
  11. Known limitations
  12. The Basics sample

1. Quick start

  1. Install. In the Package Manager's My Assets, download and import Proving Ground; it goes into Assets/ProvingGround. Check the Console is free of errors. It needs Unity 6 and no other packages.
  2. Mark some values. On any component, add using Exaweft.Proving;, put [Tune] on the fields you want to tune, and register the component while it is enabled:

    using Exaweft.Proving;
    using UnityEngine;
    
    public class PlayerMovement : MonoBehaviour
    {
        [Tune("Movement", 1, 18, hint: "units/s")] public float speed = 10f;
        [Tune("Movement", 0, 3)] public int extraJumps = 1;
        [Tune("Cheats")] public bool godMode;
    
        void OnEnable()  => ProvingGround.Register(this);
        void OnDisable() => ProvingGround.Unregister(this);
    }
  1. Tune. Press Play, then F1. Your values appear under "Movement" and "Cheats". Drag a slider and the game changes at once. Type a name under Presets and press Save to keep the values.
  2. See what happened. Press F2 for performance, counters, timers and events. Add your own anywhere: Diag.Count("Jumps");, Diag.Event("Boss phase 2");.
  3. Compare. Type a label in F2's Run section and press Start run; play; press End. Do the same with other settings and a different label, then press Compare runs… to see them side by side.

Changes made in Play Mode go when Play Mode ends, as usual in Unity (ScriptableObject assets included, see section 2). Save a preset to keep them, and copy the numbers you settle on into your scenes or assets.

To see all of this working before touching your own game, open the Basics sample (section 12).

2. Tuning values with [Tune] and registration

Mark fields with [Tune] and register the object. Supported types are float, int, bool and enums (not [Flags] enums). Fields may be public or private, but not static or readonly. Auto-properties work with [field: Tune], as long as they have a setter (a private one is fine); they appear under the property name. Values grouped in a struct or class, such as a Stats struct, are reached by marking both the field that holds it and the fields inside it (see "Values inside a struct or class" below).

public class PlayerMovement : MonoBehaviour
{
    [Tune("Movement", 1, 18, step: 0.5f, hint: "units/s")]
    public float speed = 10f;

    [Tune("Movement", 0, 3)]
    public int extraJumps = 1;

    [Tune("Cheats")]
    public bool godMode;

    void OnEnable()  => ProvingGround.Register(this);
    void OnDisable() => ProvingGround.Unregister(this);
}

Values inside a struct or class

Mark the field that holds the struct or class, and each field inside it you want to tune:

public class Kart : MonoBehaviour
{
    [Tune("Handling")]
    public Stats stats = new Stats { topSpeed = 10f, grip = 0.95f };

    [System.Serializable]
    public struct Stats
    {
        [Tune(null, 1, 30, hint: "m/s")] public float topSpeed;
        [Tune(null, 0, 1)] public float grip;
    }

    void OnEnable() => ProvingGround.Register(this);
    void OnDisable() => ProvingGround.Unregister(this);
}

Fields that can't be tuned are skipped with a warning in the Console naming the field and the reason.

From code, ProvingGround.Tuning lists every value (Values, Find(key)) and resets them (ResetAll, ResetGroup, or Reset on one value). Its ValueChanged event reports changes made through Proving Ground:

ProvingGround.Tuning.ValueChanged += value =>
{
    if (value.Key == "MyGame.Player.gravityScale") body.gravityScale = (float)value.Value;
};

3. Presets

ProvingGround.Presets saves and loads named sets of values as JSON files:

ProvingGround.Presets.Save("Fast enemies", out string message);
ProvingGround.Presets.Load("Fast enemies", out message);
IReadOnlyList<string> names = ProvingGround.Presets.List();

4. The F1 panel: hotkeys, layout and [DebugAction] buttons

In the Editor and in development builds, press F1 in Play Mode to show or hide the panel. It lists every registered value by group, with the group's [DebugAction] buttons at the top.

public class Player : MonoBehaviour
{
    [DebugAction("Testing", "Restore health", hint: "fills shield and hull")]
    void RestoreHealth() { /* game code */ }

    void OnEnable()  => ProvingGround.Register(this);
    void OnDisable() => ProvingGround.Unregister(this);
}

[DebugAction] methods take no parameters and may be private. A button runs its method on every registered object that has it; an exception is logged to the Console and reported on the status line.

From code:

ProvingGround.Panel.ToggleKey = KeyCode.BackQuote;   // KeyCode.None turns the hotkey off
ProvingGround.Panel.Title = "My Game";
ProvingGround.Panel.Open();

Default placement. If your game's own HUD sits where the panels would, choose their starting sides from code, for example in a bootstrap component's Awake:

ProvingGround.Panel.DefaultPlacement = PanelPlacement.Right;
ProvingGround.DiagnosticsPanel.DefaultPlacement = DiagnosticsPlacement.Right;  // F2 beside F1, both on the right

A default applies until someone picks a placement with the panel's buttons (or you set Placement); the pick is remembered and wins from then on. ForgetPlacement() returns a panel to its default. The F2 panel's own buttons are Auto (opposite the F1 panel, the default), Left and Right. When both panels are docked on the same side and open, F2 sits beside F1 instead of on top of it.

The panels are UI Toolkit, and Unity always draws OnGUI (IMGUI) on top of UI Toolkit, so a game's own OnGUI text shows through them. Skip it while a panel is open if it gets in the way, for example if (ProvingGround.DiagnosticsPanel.IsComparisonOpen) return; at the start of OnGUI.

The hotkey works with the Input System package and with the legacy Input Manager. Function keys stay live while typing; other hotkeys are ignored then so they can be typed. Esc ends typing in a panel box.

The panel draws on its own UI Toolkit panel settings above the game's UI, with no style sheets or fonts of its own (it uses Unity's built-in runtime font), so it doesn't affect the game's UI. Nothing is built until the panel is first opened.

5. Diagnostics: Diag.Event, Diag.Count, Diag.Timer, performance and logs

Record what happens from anywhere in game code. Press F2 in Play Mode to see it live.

using Exaweft.Proving;

Diag.Event("Boss phase 2");            // timestamped, shown in recent events and written to the log
Diag.Count("Deaths");                  // counters add up; Diag.Count("Coins", 5) adds 5
using (Diag.Timer("Path search"))      // times the work inside the block
{
    FindPath();
}

// A span across frames, such as a lap: keep the timer and dispose it when the span ends.
DiagTimer lap = Diag.Timer("Lap");
// ... later
lap.Dispose();

From code, ProvingGround.Diagnostics gives the same data: Counters, Timers, RecentEvents, Performance, Summary(), CopySummary(), OpenLogFolder(), LogFile and LogStatus. ProvingGround.DiagnosticsPanel has ToggleKey (F2), Open, Close, Toggle, IsOpen and the placement settings above.

6. Run records and comparison

A run is a stretch of play with a label: one attempt at a level, one lap, one bot round. When it ends, Proving Ground saves a run record linking the exact settings it started with to what happened, so you can see which settings played best.

ProvingGround.Runs.Start("Evade");                    // label: runs are grouped by it when compared
ProvingGround.Runs.Start("Fast", preset: "Fast");     // load a preset first, so the run starts with exactly its values
ProvingGround.Runs.End("player destroyed");           // the outcome, saved with the record

7. Scripted runs

Runs can be driven entirely from code: a test script plays the same round several times under each of a few presets, and the comparison shows how the presets did. The script plays the game; Proving Ground loads the presets, records each round and compares them. Proving Ground doesn't include bots or strategies; the script that plays your game is yours, because only your game knows what "playing" means.

The Basics sample (section 12) includes RunBatch, a short, reusable coroutine for this. Copy it into your project:

// Three rounds under each preset, alternating presets; each round is a run labelled with its preset.
StartCoroutine(RunBatch.Play("Jump test", new[] { "Low jump", "High jump" }, 3, PlayOneRound));

IEnumerator PlayOneRound(RunBatch.Round round)
{
    var random = new System.Random(round.Seed);      // the same seed for every preset in this round
    ResetLevel(random);
    yield return new WaitUntil(() => levelFinished);
    round.Outcome = playerWon ? "won" : "lost";        // saved with the run
}

Without the helper, the same thing is a few lines:

ProvingGround.Runs.BeginBatch("Jump test");
foreach (string preset in new[] { "Low jump", "High jump" })
    for (int i = 0; i < 5; i++)
    {
        ProvingGround.Runs.Start(label: preset, preset: preset);
        yield return PlayOneRound();
        ProvingGround.Runs.End("round over");
    }
ProvingGround.Runs.EndBatch();
ProvingGround.DiagnosticsPanel.OpenComparison(selectLatestBatch: true);   // show the result

What makes scripted runs worth comparing:

8. Keeping game input away from the panels

The panels can be clicked and typed into while the game is running, so a game may need to ignore input meant for them. Proving Ground never reads or blocks your game's input itself; these properties tell your code when to:

PropertyTrue while
ProvingGround.IsPointerOverPanelsthe pointer is over either panel or the comparison
ProvingGround.Panel.IsTypinga Proving Ground text box (search, a number, a preset name, a run label) has the keyboard
ProvingGround.Panel.IsOpen, ProvingGround.DiagnosticsPanel.IsOpen, IsComparisonOpenthat panel is shown

Clicks. Ignore a click or tap that lands on a panel:

if (Input.GetMouseButtonDown(0) && !ProvingGround.IsPointerOverPanels) Shoot();          // Input Manager
if (Mouse.current.leftButton.wasPressedThisFrame && !ProvingGround.IsPointerOverPanels) Shoot();  // Input System

The scroll wheel. Scrolling a panel's list also turns the mouse wheel your camera may be reading:

float zoom = ProvingGround.IsPointerOverPanels ? 0f : Input.GetAxis("Mouse ScrollWheel");

Keyboard. Typing "12" into a number box would also press 1 and 2 in your game. Skip gameplay keys while typing:

if (!ProvingGround.Panel.IsTyping && Input.GetKeyDown(KeyCode.Alpha1)) SelectWeapon(1);

With the Input System and actions, the simplest way is to switch your gameplay action map off while typing:

void Update()
{
    bool typing = ProvingGround.Panel.IsTyping;
    if (typing && gameplay.enabled) gameplay.Disable();
    else if (!typing && !gameplay.enabled) gameplay.Enable();
}

Clicking in the game, or pressing Esc, ends typing.

A locked cursor. Games with mouse look usually lock and hide the cursor, which leaves the panels unclickable. Either let Proving Ground free it while a panel is open:

ProvingGround.FreeCursorWhileOpen = true;   // set it at startup, for example in Awake

It frees the cursor when the first panel opens and puts back how it was when the last one closes, unless your game changed the cursor meanwhile, in which case your game's setting stands. It acts only as panels open and close, so a game that locks the cursor every frame, or on any click, still needs its own check:

bool panels = ProvingGround.Panel.IsOpen || ProvingGround.DiagnosticsPanel.IsOpen;
if (!panels && Input.GetMouseButtonDown(0)) Cursor.lockState = CursorLockMode.Locked;

Also skip mouse look while a panel is open, or the view turns as you drag a slider.

UI navigation. With an EventSystem in the scene, the arrow keys and WASD move UI focus; Proving Ground stops them moving focus into its own text boxes, so they keep driving your game.

9. Release builds and performance

Proving Ground is on in the Editor and in development builds (Development Build ticked in the build profile) and off in every other build. ProvingGround.IsEnabled says which. Off means the API is still there, so game code compiles and runs unchanged, but nothing happens:

Opening a panel while it's off logs one line saying why, once per session.

Playtest builds. To keep Proving Ground in a build that isn't a development build, such as one sent to testers, add PROVING_GROUND_PLAYTEST to that build profile's Scripting Define Symbols (Player settings, or the profile's own settings in Unity 6 Build Profiles). Make a separate profile for it so the release profile stays clean. PROVING_GROUND_OFF turns it off everywhere, including the Editor and development builds; it wins over the playtest define. Builds you send to testers are unsigned, like any Unity build, and some antivirus programs flag unsigned programs they haven't seen before; that applies to the build as a whole, not to Proving Ground.

Cost while the panels are closed. Using Proving Ground the usual way (registered values, a counter and a timer every frame), development and playtest builds allocated nothing over 600 frames with the panels closed, and release builds allocated nothing either. Diag.Event writes to the log, so keep events to things worth reading rather than calling it every frame.

Code stripping. Proving Ground finds [Tune] fields and [DebugAction] methods by reflection. In IL2CPP builds at every managed stripping level up to High, they were kept, including a [DebugAction] method nothing else calls. No link.xml is needed.

What ships. The package's runtime assembly (Exaweft.Proving.dll) is in every build, because game code refers to it; the Editor and test assemblies never are.

10. What has been tested

Tested
Unity6000.0.85f2 and 6000.5.9f1. Other Unity 6 releases between them are expected to work but weren't tested.
EditorWindows 11
PlayersWindows 64-bit standalone: Mono (6000.0 and 6000.5) and IL2CPP (6000.5, default and High stripping); development, release and playtest builds
Render pipelinesBuilt-in, URP and HDRP (6000.5)
InputThe Input System package, the legacy Input Manager, and both together
GamesFive existing projects, from a 2D platformer to a festival-management game, besides the sample

Not tested: macOS and Linux Editors; macOS, Linux, mobile, console, WebGL and XR players; IL2CPP on 6000.0. They may work, but nothing is claimed for them.

11. Known limitations

12. The Basics sample

The sample. It is in Assets/ProvingGround/Samples/Basics, imported with the rest of Proving Ground. Open its Basics scene and press Play; everything is built from plain shapes in code, and it reads no input of its own, so it works with either input system and any render pipeline.

Support

Email support@exaweft.com. To help us answer quickly, please include: