Closed GoogleCodeExporter closed 8 years ago
Your code is correct. I'm gonna investigate this right now.
Original comment by daniele....@gmail.com
on 7 Sep 2014 at 3:09
Ooops, I quickly checked it and everything works here. Then I realized your
code is actually not correct. You're actually calling the TestCallback method
instead than assigning a reference it.
Instead than this:
OnComplete(TestCallback());
it should be this:
OnComplete(TestCallback);
Original comment by daniele....@gmail.com
on 7 Sep 2014 at 3:13
Also, the TweenCallback method should return void and not a TweenCallback:
void TestCallback()
{
Debug.Log("OnComplete Called");
}
(sorry for the multiple separated answers)
Original comment by daniele....@gmail.com
on 7 Sep 2014 at 3:14
Thanks it worked. I messed with things while I tried to pass parameters in
callback methods like HOTween's way. It would be good if you add support for
parameter in callback methods. Otherwise I will have to implement extra methods
for each callbacks.
Original comment by reek...@gmail.com
on 7 Sep 2014 at 8:57
I was actually writing about that today
(http://forum.unity3d.com/threads/dotween-hotween-v2-a-unity-tween-engine-alpha-
now-open.260692/page-3#post-1764289), and I'm still undecided. Adding
parameters support would make Tweens heavier (memory-wise) by approximately 24
B. Right now you can instead use anonymous functions/lambdas to pass the
parameters you want on the fly, like this:
void Start()
{
Tween myTween = transform.DOMoveX(45, 1).OnComplete(() => MyFunction(myTween, 45));
}
void MyFunction(Tween t, float someFloat)
{
// Do something
}
What do you think of this approach?
Original comment by daniele....@gmail.com
on 7 Sep 2014 at 9:06
Thanks. Just checked on Unity forum and implemented lambda expression. It
worked like a charm. It is easy to implement than HOTween's params. Just one
line of code.
You may update documentation page so that everyone can use the easy way.
After using lambda's I don't want to use params like HOTween's way.
Thanks for making such awesome tweener.
Original comment by reek...@gmail.com
on 7 Sep 2014 at 9:50
Very glad you like the lambda way, that took a weight out of my mind (not sure
if this is the right English expression, but I hope it's understandable)!
Indeed lambdas are one of my favorite C# features and I love them passionately.
Gonna update the documentation to explain this approach in the next days.
Original comment by daniele....@gmail.com
on 7 Sep 2014 at 9:58
Original issue reported on code.google.com by
reek...@gmail.com
on 7 Sep 2014 at 3:03