I'm trying to create a strobing platform using the following Sequence:
_seq = DOTween.Sequence()
.SetAutoKill(false)
.SetLoops(-1, LoopType.Restart) // loop forever
.SetEase(Ease.InQuad)
.Append(_ren.DOFade(1f, 0)) // instantly fade the sprite renderer to 100% opaque
.AppendCallback(() => _coll.enabled = true) // enable the platform collider
.AppendInterval(StrobeOnTime) // wait for the designated "platform on" time
.Append(_ren.DOFade(0.25f, 0)) // instantly fade the sprite renderer to 25% opaque
.AppendCallback(() => _coll.enabled = false) // disable the platform collider
.AppendInterval(StrobeOffTime); // wait the designated "platform off" time
The idea is to have a platform that's "on" (opaque, collider enabled) for a given amount of time and then "off" (see through, collider disabled) for a given amount of time - and loop forever.
The above works as expected, except the two "intervals" don't seem right. If I set the two values equally, the last one (StrobeOffTiime) is always shorter than the first one. I'm not exactly sure which one is wrong, but the timing is not as expected.
Is there anything wrong with the above?
Thanks.