I have this code:
void FunctionName( Vector3 pos, Vector3 targetPos){
Vector3[] path = new Vector3[] {
pos,
new Vector3(targetPosition.x, ((directionDown) ? 100 : -300), 0),
new Vector3(targetPosition.x, targetPosition.y + ( ( directionDown ) ? 300 : -500 ), 0)
};
Transform starEffect = starEffectObject.transform;
starEffect.localPosition = pos;
HOTween.To(starEffect,
1.5f,
new TweenParms()
.Prop(
"localPosition",
new PlugVector3Path(path, EaseType.Linear, true)
)
.OnComplete(TriggerFunction)
);
}
private void TriggerFunction() {
Debug.Log("asd");
}
My issue is that OnComplete(TriggerFunction) is not triggered as indicated in the HOTween documentation
However, if I replace OnComplete(TriggerFunction) with OnStart(TriggerFunction), everything works fine.
Can someone please assist me with this issue? Or please send me in the right direction for an alternate solution to achieving the trigger of the TriggerFunction at the end of the tween.
Thanks!
UPDATE:
I manage to trick it with:
StartCoroutine(TriggerFunction(0.2f));
IEnumerator TriggerFunction(float delay) {
yield return new WaitForSeconds(delay);
Debug.Log("asd");
}
But I feel like there is a better cleaner solution for doing this.