MoDDiB / dotween

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

Callback params #20

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Create for-loop and iterate over items (game objects for example).
2. In each iteration create tween for item.
3. Add callback for tween with params. For example in callback try destroy 
target object.
4. With lambdas every callback will handle last loop object.

What is the expected output? What do you see instead?
I want to destroy target object in callback function. I want handle destroy 
operation with correct callback params (custom objects for additional checks).

I think this behaiour normal for lambdas, but I need normal callbacks.
With HOTween I can create separate callbacks.
I show test source code:
http://pastebin.com/11pCS1Dr

What version of the product are you using? On what operating system?
DOTween v0.9.445
HOTween v1.3.380

Original issue reported on code.google.com by alexandr...@gmail.com on 25 Dec 2014 at 12:47

GoogleCodeExporter commented 8 years ago
There is a similar issue with FOREACH loops due to the old Unity NET version 
(see faq here: 
http://dotween.demigiant.com/support.php?faq=Tweens%20inside%20foreach) but 
this is different and I never realized that. After some testing I found the 
reason: that's happening because your FOR-IN is inside a Coroutine. If you put 
it inside a regular function it will work as intended.

Here are the changes I made to your code to make it work (just made Start a 
Coroutine instead than the other methods): http://pastebin.com/BBsZZLg5

I'll add this to the FAQ now.

Original comment by daniele....@gmail.com on 25 Dec 2014 at 1:16

GoogleCodeExporter commented 8 years ago
Wow, so fast.

Now looks like works fine, thanks!

Original comment by alexandr...@gmail.com on 25 Dec 2014 at 2:40