Cause and mechanism
PlayableBehaviour runs custom behavior as part of a Playable or Timeline. If it changes a value and never restores it, the last visible state can remain after playback stops. Investigate leftover state separately from a memory leak, where unwanted memory stays allocated. A reference alone does not prove a permanent Unity-object leak.
Check and correct the setup
- Capture original state and restore it at the intended stop or graph teardown boundary.
Release / Dispose - OnBehaviourPause can also occur during pauses/evaluation. Blend overlapping clips centrally in a mixer instead of letting each restore competing values.
Release / Dispose - Unsubscribe events and dispose owned resources. Test residual values and memory growth independently.
Release / Dispose
Limits and verification
Test play, pause, seek, stop, loops, and scene transitions. Decide whether stopping should restore the original value or retain the final value.
A focused diagnostic setup
Use one custom playable changing a value/color and record residual state separately from resources increasing across repeats. Define the intended final state first.
Test in this order
- Log relevant play, pause, stop, seek and graph-destruction callbacks.
Release / Dispose - Resolve overlapping clips in a mixer instead of letting clips restore competing values independently.
Release / Dispose - List subscriptions/owned resources and compare repeated playback and scene-exit retention.
Release / Dispose
Interpret the result
Stable resource counts with residual values suggest state restoration/order. Correct visuals with increasing resources suggest cleanup problems. Pause is not identical to final destruction.