Quick Start
If you only plan to watch base type variables (e.g., string
, bool
, numeric types like float
or int
), you can skip the first two steps and go directly to Step 3.
Step 1: Set up Generator
-
In the Project Window, go to Create > LiveWatch > Generator.
-
Enter a name for the watch class (e.g.,
MyWatch
) and optionally specify a namespace. -
Click the Create File button in the
Schema Class File
field, and then in theOutput Class File
field to generate the required files.
Step 2: Define the variables in Schema
-
Open the generated schema class script.
-
Inside the
OnGenerate
method, list the variables you want to watch. For base types you don't need to generate them as they are pre-generated by default. For custom types, use theGenerate<T>()
command, whereT
is your custom type (e.g.,Generate<MyCustomType>()
).
Step 3: Create WatchCreator Script
-
In the Project Window, go to Create > LiveWatch > WatchCreatorScript.
-
Open the generated script and in the Start() method, add your watches using the following syntax:
{YourWatchClassName}.AddOrGet("YourVariableName", () => yourVariableValue);
You can place this code anywhere in your project.
What is SetAlwaysCollapsable()
?
SetAlwaysCollapsable()
hides less important value columns in Collapse mode. This will keep your watch window cleaner by hiding frequent or non-essential updates. These values will still be recorded and can be viewed by toggling the Collapse button in the watch window.
Step 4: Attach WatchCreator and Watch the magic
-
Attach the WatchCreatorScript to any GameObject in your scene.
-
Enter Play Mode, and you’ll be able to monitor your variables in Window > LiveWatch. More about Watch Window
How to use watches with several scenes
To persist your WatchCreatorScript across different scenes, use DontDestroyOnLoad(gameObject)
.
Want to Learn More?
If you want to learn more about how to use this tool in a real project, take a look at the TowerDefenceDemo
provided with this asset. This demo includes practical examples and showcases how you can use LiveWatch to track variables and debug in more complex scenarios.
Next chapter: Window Overview