How do you get the "Var Watch Enabled"?

I have “Var Watch” Enabled but none of variables like h, v, s , index, pixelCount or time(.1) will appear in the “Name” or “Value” column.

How do you make it so?

Hi @sgroen,
Any global variable that is exported will show up (set in the main body of code). The variables defined inside functions, including their arguments won’t show up, but you can capture them to an exported global.

e.g.

export var t1

export function beforeRender(delta) {
  t1 = time(.1)
}

export function render(index) {
  h = t1 + index/pixelCount
  s = 1
  v = 1
  hsv(h, s, v)
}

If you wanted to capture one of the h values at a given pixel index, you could do so like this:

export var t1
export var h10 // the h value when at pixel index 10

export function beforeRender(delta) {
  t1 = time(.1)
}

export function render(index) {
  h = t1 + index/pixelCount
  
  if (index == 10) {
    h10 = h
  }
  
  s = 1
  v = 1
  hsv(h, s, v)
}

Both scalar values and arrays can be watched like this, as long as they are exported.

Exported vars can also be accessed via the websocket API.