WatchReference
WatchReference<T>
is a struct type returned by most Watch methods, providing straightforward access to common operations for watch variables.
ChildCount
Returns the number of child variables. Returns 0 if there are none.GetChildNames
Retrieves a collection containing the names of all child variables.GetOrAdd
Retrieves an existing child variable or adds a new one with the specified namepath
and type V
.
This method is similar to GetOrAdd()
.
SetAlwaysCollapsable
Configures the variable columns to always be collapsable. If Collapse button is enabled in the Watch window, values from these variables will behave as if they haven't changed. This is useful for constantly changing values, to prevent cluttering.SetSortOrder
Assigns a sorting order to the variable, determined by the specifiedvalue
.
This functions similarly to scripting execution order in Unity: a higher value places the variable lower in the display order and vice versa.
If no sorting order is specified, it defaults to the creation order of the variables, with a float value expected between 0
and 1
.
SetTitleFormat
Overridesformat
for the variable's display area.
SetDefaultValueFormat
Overrides the defaultformat
for the variable's values.
AddConditionalValueFormat
public WatchReference<T> AddConditionalValueFormat(Func<T, bool> condition, WatchValueFormat format)
format
based on a condition.
condition
is a delegate that takes a value of type T
and returns whether the condition is met.
If multiple conditions are true
for the same value
If multiple positive conditions are present, only the last one will take effect.
public WatchReference<T> AddConditionalValueFormat(Func<T, bool> condition, Func<T, WatchValueFormat> dynamicFormat)
dynamicFormat
that determines the format based on the value.
PushValueFormat
Directly pushes valueformat
to the variable. Pushing formats functions like pushing values and must be done before calling Watch.UpdateAll()
.
PushExtraText
Pushes additional text 'extraText' to the variable. Similar to pushing values, this must also be done beforeWatch.UpdateAll()
is called.
PushEmptyValue
Pushes an empty value to the variable and all of its children recursively, constrained bymaxRecursionDepth
. If withRoot
is set to false
, the empty value will not be pushed to the target variable itself, only to its children.