GitHub - yjlintw/Tweenie at blog-day4
The previous code had a problem where if a tweener was still running but the tweener-associated object was destroyed, it would result in a MissingReferenceException. To address this issue, we have implemented exception handling using a Try/Catch block when updating the parameters. In the event of an exception, the Tweener will now destroy itself.
The updated code resolves this problem by implementing the following changes:
bool TrySetParam(T value)
{
try
{
Param(value);
}
catch (MissingReferenceException e)
{
Debug.Log($"The parameter this tweener is setting is missing. " +
"Don't worry. Tweenie handles it. This tweener will be destroy in next frame.\\n" +
$"{e.Message}");
Destroy();
return false;
}
catch (Exception e)
{
Debug.LogError(e);
Destroy();
return false;
}
return true;
}
I added a status field in the Tweenie Inspector to show the current number of active tweeners. This allows you to easily monitor the active tweeners directly from the Inspector.

package.json fileTo try the package in Unity through UPM. Adding it using this URL
<https://github.com/yjlintw/Tweenie.git?path=/Assets/Tweenie>
Not in any particular order
AnimationCurve to allow different ease in / out animationTweener objects to avoid garbage collection (?)