#477·UniRx

ObservableStateMachineTrigger issue when disabling animator or parent object

Author: TheAtomAntCreated Oct 25, 2020Updated Jan 19, 2023

It seems that Unity will recreate the ObservableStateMachineTrigger instance when the animator or the object holding the animator (or any object up the hierarchy) is disabled and then reenabled. This causes any state subjects created to be recreated with the new instance of the ObservableStateMachineTrigger.

a debug.log statement in the ObservableStateMachineTrigger constructor will show it being created whenever an animator is enabled/disabled. I am worried that stuff isn't being cleaned up correctly when this happens too. Not sure how best to solve this...