Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

iTween.Pause not pausing

Discussion in 'Scripting' started by CPUFreak91, Jan 8, 2012.

  1. CPUFreak91

    CPUFreak91

    Joined:
    Oct 1, 2007
    Posts:
    44
    Hi,
    I have the following code cycling through an array of waypoints (from the iTween waypoint demo) and I'm trying to pause it at random times (when the player picks up a powerup).

    Code (csharp):
    1. iTween.MoveTo(gameObject,iTween.Hash("position",waypoints[currentWaypoint],"time",travelTime,"easetype",easeType,"oncomplete","MoveToWaypoint","Looktarget",waypoints[currentWaypoint].position,"looktime",0, "ignoretimescale", false));
    The problem is, the animation does not pause. It slows down, and then when I call iTween.Resume it ignores the next waypoint and continues travelling along whichever axis it was moving along before (and during) the time it was "paused".
     
  2. RobertWiggin

    RobertWiggin

    Joined:
    Nov 26, 2009
    Posts:
    8
  3. CPUFreak91

    CPUFreak91

    Joined:
    Oct 1, 2007
    Posts:
    44
    Thanks for the suggestion Vhael. I didn't think to try the type. Unfortunately neither calling iTween.Pause(gameObject, "move") or iTween.Pause() on the entire scene affects anything.
     
  4. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,239
    Have you tried iTween.Pause(gameObject), without the "move"?
     
  5. CPUFreak91

    CPUFreak91

    Joined:
    Oct 1, 2007
    Posts:
    44
    Yes I have. Same effect. It just slows down the animation until I resume, then travels down the axis it was moving along before and ignores the end position of the animation.

    EDIT: Additionally, the same thing happens when I try to pause MoveBy as well as MoveTo
     
    Last edited: Jan 8, 2012
  6. davebuchhofer

    davebuchhofer

    Joined:
    Nov 9, 2007
    Posts:
    126
    I'm seeing the same thing here trying to pause a MoveTo() with a path.

    trying to decipher why in the code doesn't look like fun.
     
  7. CPUFreak91

    CPUFreak91

    Joined:
    Oct 1, 2007
    Posts:
    44
    I've found a temporary workaround, where I save the gameObject's current world position at the time of "pausing". Then keep setting it's position to that saved position in Update(). When the MoveTo call is finished, the callback function sets the next MoveTo() to the position I saved to make resuming work smoothly.

    Upon resuming, I call MoveTo() again on the normal path (whichever point was next before I "paused").
     
    Last edited: Jan 14, 2012
  8. CPUFreak91

    CPUFreak91

    Joined:
    Oct 1, 2007
    Posts:
    44
  9. mrKaizen

    mrKaizen

    Joined:
    Feb 14, 2011
    Posts:
    139
    I tried on an obj with MoveTo - pause works, resume works.
    I remember to have issues time ago.. question: do you have last version? (2.0.45)
     
  10. RicardoMSousa

    RicardoMSousa

    Joined:
    Dec 1, 2018
    Posts:
    2
    Hi. If an iTween is established with "ignoreTimeScale" set to true pause will not currently work.
    This message is in the Itween documentation.
    I suppose that's why it doesn't work since you're using the "ignoreTimeScale".