Skip to content

Reactive Objects

Reactive objects turn simulation conditions into an influence between 0 and 1, then apply a response. A streetlight, seasonal material, particle effect, or your own interaction can share this activation model without owning a second simulation.

Configure your first response

  1. Add a suitable built-in response, such as Tunal > System Based > System Based Light to a Light.
  2. Assign Context explicitly for objects outside a context hierarchy. Otherwise Auto Resolve Parent Context can find an ancestor context; it does not guess between worlds elsewhere in the scene.
  3. Keep Automated on. Add Conditions and choose Combine All or Any.
  4. Set inactive/active response values and Transition Duration. Enter Play Mode and inspect Live Tunal Evaluation.

Target Influence is the condition result; Applied Influence is the smoothed output. Duration is seconds for a full 0→1 change, default 0.5; zero is immediate. Smoothing uses Unity scaled delta time, not the context's simulated time rate. This differs from historical lifecycle progression.

An initialized context with no conditions evaluates to full influence. A missing/uninitialized context in automated evaluation yields zero. All combines by minimum, Any by maximum: these preserve partial ramps instead of multiplying every condition. A source that is unavailable never becomes true just because its condition is inverted.

Automatic and manual control

SetAutomated(false) selects manual influence. SetManualInfluence(value, immediate) clamps to 0–1 and requests re-evaluation. Refresh(true) requests immediate application on the reactive update; it is not a synchronous call to your effect. SetContext(context) rebinds at runtime.

Responses apply in Play Mode. Source events mark state dirty; the base reconciles relevant subscriptions and availability and applies results in LateUpdate. Supplied responses use execution order 5000. Re-enable/context changes request a fresh application; changing Inspector fields in edit mode does not apply effects to your scene.

Extend beyond the demos

Derive from SystemBasedObject to apply influence to a customer-defined effect. The framework is not restricted to the example art assets. Custom gameplay predicates can drive manual influence from a separate component; SystemCondition is sealed and is not a polymorphic custom-condition plugin API. See extensions before implementing a new behavior.

If target influence is right but nothing changes, check the response's target/property/threshold. If the target is wrong, inspect the condition and context first. Do not hide the response host under its own visibility target.

Related: conditions, responses, Lifecycle.