Search Unity

iTween: How to test if an object is "iTweening" ?

Discussion in 'Scripting' started by luigix, Mar 9, 2011.

  1. luigix

    luigix

    Joined:
    Mar 13, 2010
    Posts:
    15
    I folks,
    well I'm working on a puzzle game like bejeweled were many object at (almost) the same time have to "explode".

    I'm of course using iTween for effects, but I don't know how (and if it is possible to) to test if all my objects are exploded (I mean their iTween.scaleTo function has finished or not) to do other things like replace them with new objects.

    I'd need something like
    bool iTween.isTweening(Gameobject gameObject)

    so far I made an iTweenControlClass which keeps track of how many objects are still tweening (using the onStart and onComplete, to change a counter), but I still have some kind of issues for some kind of strange timing stuff / deadlocks
    (as I'm using the [MethodImpl(MethodImplOptions.Synchronized)] )

    Thanks in advance
     
  2. spacepaw

    spacepaw

    Joined:
    Jul 18, 2010
    Posts:
    23
    public bool isRunning,isPaused; <= those are public variables in the iTween class. You can just refer to them :)
     
  3. luigix

    luigix

    Joined:
    Mar 13, 2010
    Posts:
    15
    Oh gosh I hate it when I feel this dumb :)
    But really thank you!!!
     
  4. luigix

    luigix

    Joined:
    Mar 13, 2010
    Posts:
    15
    finally got a chance to check it out, and I can see they are not static and I can't access them directly :(

    Plus I need to test if some objects (many but not all ofg them) are tweening and not if the entire iTween system is working.

    I just noticed the iTween.tweens.Contains may be it might be useful...
     
  5. luigix

    luigix

    Joined:
    Mar 13, 2010
    Posts:
    15
    Got it to work finally!!!

    the static method "Count" let you know how many Tweens are attached to the object (also a type based filter).


    IEnumerator startTween() {
    iTween.MoveTo(gameObject, new Vector3(5,0,0), 3);

    while (iTween.Count(gameObject)>0) {
    yield return new WaitForSeconds(0.5f);
    Debug.Log("waiting... count is:"+iTween.Count(gameObject));
    }

    Debug.Log("the wait is over!!!");
    iTween.MoveTo(gameObject, new Vector3(-5,0,0), 3);
    }
     
  6. pixelplacement1

    pixelplacement1

    Joined:
    Aug 19, 2009
    Posts:
    674
    Good stuff! Glad you figured out a solution.
     
  7. saifshk17

    saifshk17

    Joined:
    Dec 4, 2016
    Posts:
    488
    iTween.isRunning no longer working now?
     
  8. lordofduct

    lordofduct

    Joined:
    Oct 3, 2011
    Posts:
    8,528
    It's been almost 10 years since this thread was active. I doubt this thread would necessarily know.

    Since iTween is a 3rd party library you may want to check out their release notes and documentation.