- Home /
Detect animation completion in iTween
I perform scale down animation for GameObject. After scale down animation complete I want to perform specific task. So that I want to call method using iTween code.
Used code
iTween.ScaleTo (other.gameObject, iTween.Hash ("x", 0.1f, "y", 0.1f, "time", 1f, "oncomplete", "ScaleAnimationComplete()"));
private void ScaleAnimationComplete ()
{
print ("scale animtion");
}
Using above code scaling is performed but not call any completion event.
I have already played with small changes but not able to get success in this. Please someone help me.
Answer by saschandroid · Jun 05, 2014 at 09:14 AM
iTween.ScaleTo (other.gameObject, iTween.Hash ("x", 0.1f, "y", 0.1f, "time", 1f, "oncomplete", "ScaleAnimationComplete", "oncompletetarget", GameObjectWithScaleAnimationCompleteFunction));
You have to add "oncompletetarget" and "a reference to the GameObject that holds the "oncomplete" method" (iTween-doc).
Answer by robertbu · Jun 05, 2014 at 08:33 AM
Remove the '()' from the string:
iTween.ScaleTo (other.gameObject, iTween.Hash ("x", 0.1f, "y", 0.1f, "time", 1f, "oncomplete", "ScaleAnimationComplete"));
I have remove brackets from code but it didn't call completion method.
Your answer
Follow this Question
Related Questions
Move Object Using iTween 2 Answers
Octopus movement 0 Answers
Crushy Bird Game Doubt 1 Answer
Random Entry of Object 1 Answer
Single Time Animation Play 1 Answer