Smooth-Motion-in-Unity
Smooth-Motion-in-Unity copied to clipboard
Disabling/re-enabling interpolated gameobject will break InterpolationObjectController
I know this repo hasn't been updated in a while but I wanted to point this out for people coming across it.
Since the coroutines in InterpolationObjectController are started in Awake and are automatically stopped upon the gameobject being disabled, re-enabling said gameobject will not re-enable the coroutines, which had me stuck for a while. I haven't tested this, but I think the lines:
StartCoroutine(WaitForEndOfFrame());
StartCoroutine(WaitForFixedUpdate());
Should be moved to OnEnable()
Otherwise it works well! Thanks.
That said, I decided to use the three scripts from the original article, as I wanted to avoid allocations with StartCoroutine. https://kinematicsoup.com/news/2016/8/9/rrypp5tkubynjwxhxjzd42s3o034o8?utm_type=SMVideo
Have a good one : )