- Home /
iTween: oncomplete triggers on all components that define $oncomplete function name
How to avoid this iTween behavior (any overloads or other workarounds?):
1) Create empty gameobject. 2) add 2 scripts where each script defines private function called OnCompleteHandler
private void OnCompleteHandler() {}
3) first script will also contain iTween call, something like:
iTween.MoveTo(movableGameObject, iTween.Hash(
"position", Vector3.zero,
"time", 1f,
"oncomplete", "OnTweenComplete",
"oncompletetarget", this.gameObject
)
);
Make sure you get ref to your targetGO (doesnt matter what GameObject that is or where it is).
The fun starts now. As soon as you run, and iTween completes animation, OnTweenComplete will fire in BOTH scripts! It fires twice! It even fires OnTweenComplete in other, disabled scripts (as long as they are attached to the same GameObject)! How can i only tell it to fire in the script in which it was invoked? Target specific MonoBehaviour instance only? Help!
Your answer
Follow this Question
Related Questions
iTween Native Support OnComplete 0 Answers
iTween fires oncomplete twice if LoadLevel in oncomplete 1 Answer
iTween oncomplete method on normal C# class 1 Answer
iTween callback functions not firing 1 Answer
Itween oncomplete and inspector 0 Answers