Closed GoogleCodeExporter closed 8 years ago
Hello,
DOTween doesn't create tweens by itself: each tween is created manually via one
of your scripts. I imagine you're creating tweens inside an Update call at
every frame, thus generating tons of them? Can you show me the code you're
using?
Original comment by daniele....@gmail.com
on 23 Jan 2015 at 8:21
Le 23/01/2015 21:21, dotween@googlecode.com a écrit :
Hello,
Agree with what you say, but the tweens are not called in update (only
for the first call) then call themselves using OnComplete().
Everything works perfectly, until I active DebugMode. By the way if
Debug is active before playing and then I switch to Normal while
playing, the same problem appears.
Before entering Update(), the variable Status is set to
RelayStatus.SetIdling.
public void Update()
{
switch (Status)
{
case RelayStatus.SetIdling:
IdlePosition();
IdleLight();
Status = RelayStatus.Connected;
break;
case RelayStatus.Connected:
break;
case RelayStatus.Disconnecting:
break;
}
}
/// <summary>
/// Change light intensity while idling
/// </summary>
private void IdleLight()
{
Light.DOIntensity(Random.Range(LightMin, LightMax),
0.1f).OnComplete(IdleLight);
}
/// <summary>
/// Move relay while idling
/// </summary>
private void IdlePosition()
{
// Calculate default position for relay
var RelayPos = new Vector3
{
x =
_MasterConnection.GameObject.transform.position.x < transform.position.x
? _MasterConnection.GameObject.transform.position.x +
MaxSourceDistance :
_MasterConnection.GameObject.transform.position.x - MaxSourceDistance,
y = _SlaveConnection.GameObject == null
?
_MasterConnection.GameObject.transform.position.y
:
(_MasterConnection.GameObject.transform.position.y +
_SlaveConnection.GameObject.transform.position.y) / 2,
z = transform.position.z
};
// Randomize in idling rect
var NewPos = RelayPos
+ new Vector3(
Random.Range(IdlingRect.min.x, IdlingRect.max.x),
Random.Range(IdlingRect.min.y, IdlingRect.max.y),
0);
transform.DOMove(NewPos,
2).OnComplete(IdlePosition).SetEase(Ease.OutBack);
}
Original comment by sgl...@gmail.com
on 23 Jan 2015 at 8:31
[deleted comment]
I've bypassed the issue by restarting the tweens during update() call.
Original comment by sgl...@gmail.com
on 23 Jan 2015 at 9:16
Oh I get it now.
Restarting the tween is surely a better solution (but even better would be to
just set the same one to loop indefinitely using SetLoops, if I understand
correctly your usecase).
Still, I managed to replicate your issue and it's actually a bug (which happens
if you create a tween during an OnComplete of a very short-timed tween). I
fixed it in the version you find attached :)
Original comment by daniele....@gmail.com
on 23 Jan 2015 at 11:42
Attachments:
Perfect! The bug is corrected.
I can't use SetLoops because the Tween values are changed at each call.
Original comment by sgl...@gmail.com
on 24 Jan 2015 at 9:57
Original issue reported on code.google.com by
sgl...@gmail.com
on 23 Jan 2015 at 7:59Attachments: