Skip to content

Create a custom reactive response

Tunal can drive your own visual or interactive objects. This example fades a CanvasGroup and changes its interaction state using the existing influence evaluator.

  1. Create InfluenceCanvas.cs from the complete response example.
  2. Add it to a Canvas object with CanvasGroup. Assign the intended context and activation conditions.
  3. Keep Automated enabled to evaluate Tunal conditions, then enter Play Mode and change the source state.
  4. Confirm alpha follows applied influence and interaction becomes available at the example's 0.5 threshold.

The supported hook is ApplyInfluence(float influence, bool immediate). Keep the base component's binding/update lifecycle and use the supplied late execution order on the derived response. Avoid adding another script that independently writes the same CanvasGroup properties.

For an external gameplay decision, use GameplayInfluence from that guide: disable automation with SetAutomated(false), then supply a clamped signal through SetManualInfluence. This avoids changing Tunal's sealed built-in condition representation.

Related: event timing, presentation adapters.