akhilkrushnaa / hotween

Automatically exported from code.google.com/p/hotween
0 stars 0 forks source link

Tween inside sequence have wrong from value #74

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1.Create a game object Cube with yellow material and attach C# code:

HOTween.To(renderer.material, 10, new TweenParms().Prop("color", 
Color.red).Delay(2));
HOTween.To(new Vector3(), 1, new 
TweenParms().Prop("x",0).OnComplete(delegate(TweenEvent p_callbackData){
    renderer.material.color=Color.white;
}));

2.Create second game object Cube with yellow material and attach C# code:
Sequence seq = new Sequence();
seq.InsertCallback(1, delegate(TweenEvent p_callbackData){
    renderer.material.color=Color.white;
});
seq.Insert(2, HOTween.To(renderer.material, 10, new TweenParms().Prop("color", 
Color.red)));
seq.Play();

3.Play

What is the expected output? What do you see instead?
Expected : Both game object Cube perform same animation. Both cubes will remain 
yellow color for 1 seconds, and start tweening color from White to Red in 10 
seconds duration
See : Different animation. First Cube perform animation as above, Second cube 
will remian yellow color for 1 seconds, became white color for very short 
moment and start tweening color from yellow to Red in 10 seconds duration

What version of the product are you using? On what operating system?
1.1.780, Lion, Unity4.3.4f, Test in Unity Editor

Please provide any additional information below.

Original issue reported on code.google.com by wei2le...@gmail.com on 17 May 2014 at 8:50

GoogleCodeExporter commented 8 years ago
That is expected behaviour. Once a Sequence starts, all tweens are run once to 
determine their starting value. Callbacks though are not run. That means that 
changing the material inside a callback will happen, but only while the tween 
is not playing. Then the original behaviour will take place.
If you want to change the color and have it considered, you should add a tween 
(even a 0 duration one) that changes it to white, instead than using a callback.

Original comment by daniele....@gmail.com on 17 May 2014 at 12:44