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

HOTween: a fast and powerful Unity tween engine

Discussion in 'Assets and Asset Store' started by Demigiant, Jan 7, 2012.

  1. wightwhale

    wightwhale

    Joined:
    Jul 28, 2011
    Posts:
    397
    Howdy, I've discovered what the issue is with HOTween running slowly for me. In my game I have objects with compound colliders. These objects can have upwards of 100 box colliders attached to each object. I haven't run into problems doing my colliders like this anywhere but with the tweening suites. Perhaps you have an idea what is making it slow or maybe I could look at your tweening and try and optimize it for my purposes? Anyhow I can't imagine I'm the only person trying to use tweening on objects with complex colliders. When using the unity animation system I didn't experience the same slowdowns.
    And thanks for the tips :)
     
  2. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,239
    Howdy :) HOTween is just math, and simply tweens the property you tell it to tween, regardless of whether it has colliders or not, so I really don't think it might be causing the slowdown issue. I suppose the issue might be with the movement of an object with many colliders, not with the engine that moves it. That's because Unity has to update many transforms (all the object's children) each time the main parent transform changes, and if physics are involved, also has to calculate a lot of additional stuff.

    About unity animation system having less slowdown, maybe you tested it inside Unity Editor and not in an actual build? The animation system surely goes faster than any tween engine (since it does a lot less stuff), but unless you're animating thousands of objects at the same time it should almost be unnoticeable.

    Anyway, I made a test: HOTween VS a simple script that updates the position of a transform on each Update. I tried both on an object with 1000 colliders, and I'm getting approximately the same FPS. In both cases, FPS drop down a lot as soon as the object starts moving.

    That said, HOTween's code is public on Google Code, so sure you can look at it. Let me know :)

    P.S. if you made some test project, could you post it so I can check it, and see if I find something?
     
  3. wightwhale

    wightwhale

    Joined:
    Jul 28, 2011
    Posts:
    397
  4. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,239
    I meant a test project from which you deduced that HOTween was causing problems with compound colliders. Maybe you sent me the wrong one, but there's just a tweened cube with no compound colliders in there :)
    Anyway, I expanded those tests I made and can confirm again the results and suggestions on my previous post.
     
  5. wightwhale

    wightwhale

    Joined:
    Jul 28, 2011
    Posts:
    397
    I'm sorry about that I'm not sure how the colliders got lost in that last upload. Here is an updated link with the fix. http://www.mediafire.com/?czr6spp4n4kfuab

    I only have colliders on this object and it's clear to see how slow it's running. Do you think it's possible that the colliders are colliding with themselves repeatedly during the tweening?
     
  6. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,239
    @wightwhale: checked out your latest project. And I can definitely re-confirm the issue is not with HOTween. If you have Unity Pro, you can see this with the profiler. Each frame, 92.3% of the total looks to be taken by HOTween's LateUpdate. But if you unfold its children, you'll see that all that time is taken by a single "Transform.INTERNAL_set_position()", which is simply Unity's process for changing a transform's position. It's nested under HOTween simply because HOTween is the one calling "transform.position =", but if you call it yourself, you'll see the same results.

    So, back to the real issue here :) Compound colliders don't collide with each other (or at least shouldn't). The real problem is that your object has both compound colliders AND a rigidBody. When forcing a change in the transform of such an object (by using a simple transform.position = someNewVector), Unity takes a lot of time to re-update the rigidBody and its colliders, even if you set isKinematic to false. I admit this is quite strange, since setting the rigidBody to kinematic should avoid checking for collisions etc., but something must be going on in the Unity engine. I suggest you check the forums for that, or open a thread (and please let me know if you find some deeper information, since I'm actually curious).
     
    Last edited: Apr 17, 2012
  7. Infrid

    Infrid

    Joined:
    Jan 14, 2012
    Posts:
    67
    It looks good, but I'm sad to say that I've lost a day swapping out from itween for this, and now I have to revert it..

    it's just a simple ball bounce but it just doesn't work properly in HOTween (which is terribly named, and a great way to get lots of porn sites when looking for help - well done).

    Kill doesn;t work properly, it kills everything. I've tried passing in ids, gameobjects, tweens, but no matter what - it will not kill the individual tween. Doesn't matter if called statically or on instance,
    The easing functions seem buggered - they just don't look right,
    The timings are not correct. I start 2 tweens at the same time, with the same duration, one of them finishes way before the other,
    Performance looks good in the demo but sucks hard on iOS (using correct mobile library), it's faster than itween by only 1 or 2fps, but still sucks nearly 25 fps while tweening ONE BALL.. (which is 3 tweens)..

    Crashes unity too..

    It looks very promising - but as you can see, I've just spent an extraordinarily frustrating and totally unproductive day with it. I regret ever touching it and hope others will ping back here when it is ready for use on mobile.
     
  8. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,239
    Hey infrid, sorry if you had a bad experience with HOTween (I put HO in front of all my Unity scripts, simply because my tiny company is named Holoville, not because I wanted it hot - btw, don't know what search engine you're using, but at least with Google no porn sites come out if you search HOTween related stuff).
    I'm using HOTween extensively (on an Android/iOS game among other things), and am having no issues with what you mentioned. This is the first time such issues were reported (apart iOS chrashes, which should be resolved), and I know you're now annoyed, but could you please send me some example of your non-working code so I can check it?
    • The easing functions are the official Robert Penner easings, used since the dawn of time (almost :p)
    • Time is a feature I refined a lot, and it's actually impossible for timings not to be correct, since there's a single global timer for all the tweens. Maybe you didn't create the tweens correctly?
    • HOTween is slower on iOS than on the rest of the platforms, but whatever engine you use (be it HOTween or iTween) tweening ONE ball should have no impact at all on fps, so I suppose the issue might be elsewhere.
     
    Last edited: Apr 18, 2012
  9. wightwhale

    wightwhale

    Joined:
    Jul 28, 2011
    Posts:
    397
    Hey just an update to the compound collider issue I've implemented a workaround. The workaround is a common collision detection technique. I just put a box trigger around all my compound triggers and only turn on the compound triggers when they're needed for more accurate collision. Works nice and fast now :)
     
  10. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,239
    Cool, glad you found a solution, and thanks for the update :)
     
  11. beannt

    beannt

    Joined:
    Feb 25, 2012
    Posts:
    14
    Hi, it got a bug when I pass zero duration value into tween call. The error is

    transform.rotation assign attempt for "Camera Orbi" is not valid. Input rotation is {NaN, NaN, NaN, NaN}.
     
  12. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,239
    Hi beaant :) Actually that's kind of an intended behaviour. To check if the duration is set to 0 I should add additional checks, and I preferred not to, since there's no reason to add a 0 duration tween? Let me know why you need that, and if it's important I'll fix it. Consider also that, if you just want to create a tween that immediately reaches its completion, you can call myTween.Complete() after its instantiation.
     
  13. beannt

    beannt

    Joined:
    Feb 25, 2012
    Posts:
    14
    Hi Izitmee, this is not realy significant bug and easy to workaround by checking the duration before HOTween call. I pass 0 to the HOTween call because the duration is stored in a dynamic variable controlled by the length of current playing animation (this length is zero when animation is invalid or not found). I agree with you that not checking is a good idea for performance reason :).
     
  14. veri

    veri

    Joined:
    Apr 21, 2012
    Posts:
    4
    Hi,

    I try to do something with hotween but it s hard for me.
    I want to make an object moving along a path and switching to an other path at the same percentage and continue his way.
    Can i do this with hotween ? Can someone make me a small exemple ?

    I have done it with itween but i have to many problems with constant speed.
    Here is my code :

    Code (csharp):
    1.  
    2. public class Mobile : MonoBehaviour {
    3.  
    4.     public string currentpath = "New Path 1";
    5.     public float movepercent=0;
    6.     public float speed=1;
    7.     public float current_speed=0;
    8.     public float length1=0;
    9.     public float length2=0;
    10.     public float speed_moderator=0;
    11.    
    12.     void Start () {
    13.         current_speed=speed;
    14.         length1=iTween.PathLength(iTweenPath.GetPath("New Path 1"));
    15.         length2=iTween.PathLength(iTweenPath.GetPath("New Path 2"));
    16.         speed_moderator=length1/length2;
    17.     }
    18.     void Update () {
    19.         iTween.MoveUpdate(gameObject,iTween.Hash("position",iTween.PointOnPath(iTweenPath.GetPath(currentpath),movepercent/100),"path" , iTweenPath.GetPath(currentpath), "orienttopath", true,"movetopath",false));
    20.        
    21.         if (movepercent>=100){
    22.             movepercent=0;
    23.         }
    24.         else {
    25.         movepercent+= Time.deltaTime*5f*current_speed;
    26.         }
    27.         speed+= Time.deltaTime*0.2f;
    28.        
    29.         if (Input.GetButtonDown("Fire1")){
    30.             if (currentpath == "New Path 1"){
    31.                 currentpath = "New Path 2";
    32.                 current_speed=speed_moderator*speed;   
    33.             }
    34.             else {
    35.                 currentpath = "New Path 1";
    36.                 current_speed=speed;
    37.             }
    38.         }
    39.     }
    40. }
    41.  
    Thx in advance.
     
    Last edited: Apr 21, 2012
  15. runonthespot

    runonthespot

    Joined:
    Sep 29, 2010
    Posts:
    305
    Just a thought- something I discovered in the general case of moving things with colliders around... Make sure you have a rigidbody on any moving collider, and the rigidbody set to Kinematic. It turns out that without this, PhysX has to constantly recalculate unless there is a kinematic rigidbody.

    My instinct was initially that a scene with 50 rigidbodies would be slower than just 50 meshes + colliders, no rigidbodies (since I wasn't using physics), but since colliders are physics constructs too, this is in fact not the case.

    Just thought I'd mention it.
     
  16. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,239
    @runonthespot: thanks for the insight, that is indeed interesting :)

    @veri: sorry, but I don't think I understood what you're trying to do. Could you explain me better? (also, could you edit your post and place the code inside the CODE tags? otherwise it's quite difficult to read :p)
     
  17. veri

    veri

    Joined:
    Apr 21, 2012
    Posts:
    4
    I try to do this :


    There is one path on each side of the road.
    A car moving along one path, can switch to the other one and continue its way.
     
    Last edited: Apr 21, 2012
  18. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,239
    @veri: now it's perfectly clear :) I actually tried to make a quick demo, but quickly realized it wouldn't work. Even before facing the matter of changing tracks, I suppose you want the speed of the cars to change based on acceleration. That can't be done with a tween (or at least with HOTween), where speed-based tweens keep the same speed from start to end. I'd suggest instead to build a custom engine to manage acceleration on a path. You could check HOTween's Path and PlugVector3 classes (on Google Code) and take what you need from there in order to have a constant path, and then build acceleration on top of that.
     
  19. hima

    hima

    Joined:
    Oct 1, 2010
    Posts:
    183
    I was wondering about Init and EnableOverwriteManager. Would there be a problem if we call these methods more than once?
    I want to test many parts of the game without having to go through the first scene where everything is initialized.
     
  20. yuewah

    yuewah

    Joined:
    Sep 21, 2009
    Posts:
    98
    cube1 move to (0,0)
    cube2 move to (0,0)
    cube3 move to (0,0)
    cube1, 2, 3 move to (100, 100)

    how to make them in a sequence ?
     
  21. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,239
    New update: HOTween v0.9.007
    - Sequences can now be created without parameters.

    @himatako: EnableOverwriteManager and DisableOverwriteManager can be called all the times you want, and will enable/disable the overwriteManager each time. Init instead can be called all the times you want, but will do nothing unless you call it BEFORE creating your first tween (that's because, when the first tween is created, if Init hadn't already been called it will be called automatically - and after that the internal HOTween.initialized variable will be set to true, thus skipping any other Init call).

    @yuewah: grab the latest version (otherwise you will have to define some new Sequence parameter), then:
    Code (csharp):
    1.  
    2. void Start()
    3. {
    4.    Vector3 moveTo = new Vector3(100,100,0);
    5.    Sequence mySequence = new Sequence();
    6.    mySequence.Append(HOTween.To(cube1.transform, 1, "position", Vector3.zero));
    7.    mySequence.Append(HOTween.To(cube2.transform, 1, "position", Vector3.zero));
    8.    mySequence.Append(HOTween.To(cube3.transform, 1, "position", Vector3.zero));
    9.    mySequence.Append(HOTween.To(cube1.transform, 1, "position", moveTo));
    10.    mySequence.Insert(3, HOTween.To(cube2.transform, 1, "position", moveTo));
    11.    mySequence.Insert(3, HOTween.To(cube3.transform, 1, "position", moveTo));
    12.    mySequence.Play(); // Sequences don't start automatically, so we call Play
    13. }
    14.  
     
    Last edited: Apr 26, 2012
  22. yuewah

    yuewah

    Joined:
    Sep 21, 2009
    Posts:
    98
    @lzitmee, why don't you put HOTween be Free on Unity Asset Store, so that more people knows it.
     
  23. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,239
    I wanted to do that, but I finally didn't for two reasons: a) it looked like a long process, and I preferred spending time with development, b) you can't update things immediately once they're on the Asset Store (and rightly so, since Unity needs to check what you did), which would've meant that HOTween's Asset Store version would've often been older than the website's one :p

    Anyway, I wanted to look into that again, thanks for reminding me :)
     
  24. 39thstreet

    39thstreet

    Joined:
    Jan 30, 2012
    Posts:
    104
    Really liking HOTween a lot, very straightforward! I have two quick questions about Sequences:

    1. One thing I often want to do is have a step in a sequence do an instant "tween", that is, change a scale or position immediately. I'm aware I could use a separate function to do this, but sometimes you just want it to happen in order. HOTween doesn't seem to work when you set the duration to 0, so I end up doing a tween with a duration like 0.0001f. Which works, but feels... hacky. Is there a better way?

    2. What's the best way to add a delay/pause in the middle of a Sequence? Right now end up doing a Tweener which doesn't change a value (eg. tween the scale from 1 to 1 over 3 seconds). Again, it "works", but it'd be nice if there was a built in delay method.

    Thanks in advance for any advice!
     
  25. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,239
    Hey 39thstreet, glad you're liking it :)

    1. I thought about allowing 0 duration tweens a while ago, when beannt asked it. But then I remembered that there are a lot of reasons why a 0 duration tween shouldn't be allowed. So, in your case, I'd definitely say that the hack is the right way to go :p

    2. You can add delays with AppendInterval / PrependInterval, so no hack needed there :)
     
  26. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,239
    Just wanted to mention that I finally submitted HOTween to the Asset Store (obviously for free). Should be accepted within a week. Thanks yuewah for pushing me to do it :)
     
  27. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,239
    Wow, Unity was very quick, and HOTween is already on the Asset Store :) Here's a link

    If you already have the latest version, there's no need to get it from there. Though, if you have some doubt about basic features (like Sequences), there's a simple demo which shows how to create some basic tween (which I'm gonna add to the website's examples anyway, but not today).

    Reviews are, obviously, welcome ;-)

    P.S. It says Unity 3.5 required because I created the Asset from there, but actually it should work with any Unity 3 version
     
    Last edited: May 3, 2012
  28. NateJC

    NateJC

    Joined:
    Apr 10, 2012
    Posts:
    58
    Wow, I just stumbled across HOTween and it looks great! I was a dev on the original Tweener project and the one that originally ported it to AS3. It's nice to see a Tweener nod from you on this project ;o)

    Two questions:
    1) I saw your reasoning for the package name, but what is the pronunciation? Ho Tween or Hot Tween? Either way, it is a bit of an odd name ;)
    2) I'm targeting iOS, Android, Standalone Windows / Mac with a single universal build. So I take it using the HOTweenMicro v0.9.007 (.zip) is the way to go for me?

    Looks like a great piece of work. I look forward to playing with it!
     
  29. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,239
    Hey Nate, glad you're liking it, and it's awesome that you were a Tweener developer (which, as I mentioned, was the first tween engine I ever loved - and also a really great engine) :)

    About your questions:
    1) I know, I'm starting to think the HO prefix is bad, because either it creates HOT combinations, or alludes to prostitutes. When developing plugins for Flash I used the HOLO prefix, but with 3D it sounded more confusing than else. Anyway, it's pronounced Ho Tween :p
    2) I'd suggest you use HOTween and not HOTweenMicro, unless you own the iOS pro plugin, and want to use the highest iOS level of output compression. That's because HOTween performs way better than HOTweenMicro on non-iOS platforms. Consider also that, in case you start with HOTween and need HOTweenMicro later, you can simply delete HOTween dll and replace it with HOTweenMicro, since the API stays the same.
     
  30. Acumen

    Acumen

    Joined:
    Nov 20, 2010
    Posts:
    1,041
    I pronounce it like "HotWheels" - so to me without even grasping what the engine is capable of, it just sounds like a cool SHROOOM in my head :D
     
  31. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,239
    HotWheels!!! I always wanted those when I was a kid, but neither me nor my friends could afford them, so I never saw one live! Well, then I'm overly glad of the comparison and the SHROOOM :D
     
  32. rbsn

    rbsn

    Joined:
    Aug 13, 2011
    Posts:
    4
    @Izitmee hey there,

    Im missing a property of hotween to ignore time scale and run animation on my project unity.
    I was using itween and just port to hotween and im missing this property.
    Theres a way to suggest and implement this prop?

    Thanks.
     
  33. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,239
    Hey rbsn,

    in HOTween you can already ignore time scale in two ways, using TweenParms:
    1) use UpdateType.TimeScaleIndependentUpdate, which will totally ignore Unity's timeScale, even if set to 0
    2) set your desired timeScale using the TimeScale TweenParm (which, unless you also set UpdateType to TimeScaleIndependentUpdate, will use Unity's timeScale and multiply it for HOTween's timeScale).

    You can find documentation on both here :)
     
  34. rbsn

    rbsn

    Joined:
    Aug 13, 2011
    Posts:
    4
    Thanks for quick reply,

    It worked with .UpdateType(UpdateType.TimeScaleIndependentUpdate) perfectly.

    Many Thanks.
     
  35. NateJC

    NateJC

    Joined:
    Apr 10, 2012
    Posts:
    58
    I do own the iOS Pro Plugin. But, perhaps I misunderstood. I was under the impression that the standard HOTween plugin didn't work at all on iOS. Is it only within the highest level of iOS compression that the standard HOTween plugin doesn't work?
     
  36. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,239
    Exactly. The regular version of HOTween is incompatible with micro mscorlib, which is used with iOS max stripping level - the "use micro mscorlib" one - and that's when you need HOTweenMicro instead.

    Actually, I already made plans and tests for HOTween 2, which will be faster, have a different API, and won't need a Micro version. But I won't start working on it before I finish the current game I'm doing (Journeyballs), so who knows? :p
     
  37. yuewah

    yuewah

    Joined:
    Sep 21, 2009
    Posts:
    98
    Will HOTween support iTween.MoveTo for a list of points to draw a Catmull-Rom through for a curved animation path ?
     
  38. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,239
    Hey yuewah. Not sure what you're asking. HOTween already supports movement through Catmull-Rom paths (via PlugVector3Path), and you can show the paths in the Editor if you activate gizmos and set HOTween.showPathGizmos = true.

    If you're asking if there will be a visual editor for the Catmull-Rom paths, the answer is yes, but not in the near future.
     
  39. NateJC

    NateJC

    Joined:
    Apr 10, 2012
    Posts:
    58
    Ahh, that makes complete sense now. Thanks for the explanation.

    A new question: I am animating a title screen (made with NGUI) via the HOTweenEditor. The "relative" "from" checkboxes are very convenient for doing this. Unless one of your objects has a delay, in which case you would see the object at it's final resting position before it travels into this position. This seems like a common problem with many (most?) FROM tweens that have a delay. Maybe you could include an option to activate the object automatically when the animation begins?

    Obviously, this can be done via code quite easily. But it means the difference between being able to use the HOTweenEditor exclusively to setup a title screen, or needing to move it all to a code file instead.

    Anyway, just a thought...
     
    Last edited: May 10, 2012
  40. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,239
    New release: HOTween v0.9.008
    (you can get the latest version from HOTween's website - Asset Store will be updated later)
    - FROM tweens now jump to starting position immediately, even if delayed

    @NateJC: you're totally right about the FROM behaviour: that is actually a bug, and it has just been solved :)
     
  41. 39thstreet

    39thstreet

    Joined:
    Jan 30, 2012
    Posts:
    104
    Just a follow up on this. I'm in the midst of converting a bunch of fairly elaborate Flash animations to Unity using HOTween to control them, and the lack of zero duration is still tripping me up. The hack of using an extremely short time length sometimes doesn't work (the tween never happens). There are workarounds, but it makes my code a lot more unpleasant.

    Actually, now that I think of it, what I'd really love to have is something like Sequence.AppendFunctionCall. That would solve all my issues, as it would allow me to just add any extra steps I need in a function call that would happen at the appropriate point (as opposed to tacking on to a previous step with an OnComplete, which for various reasons gets really clunky).

    Just a suggestion for a future update!
     
  42. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,239
    @39thstreet: Mhmm now that is a good point, and a good suggestion. Also, the fact that tweens never happen with a very short time is to be considered a bug. Will start looking into it in a few minutes, and see where it goes :)
     
  43. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,239
    New release: HOTween v1.1.001
    - 0 duration tweens can now be used.

    Sorry for the double release this day, but since I finally complied to the 0 duration tweens, I wanted to get it done :p Also, I decided it was finally time to give HOTween a higher version, so I skipped v1 and jumped to v1.1 :) As usual, you can find the latest version on HOTween's website (or on Google Code).

    @39thstreet: Now I'll see how I can implement the AppendFunctionCall, which I really like. Though I'm very busy these days, so if you don't see it done within next week, bump it and I'll get to it.
     
  44. NateJC

    NateJC

    Joined:
    Apr 10, 2012
    Posts:
    58
    Double bug fix in one day for a "very busy" man is fantastic in my book! Thanks for the update =D
     
  45. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,239
    Ehe, I'm a "very busy" nerd :D
     
  46. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,239
    Usually libsparks stuff is awesome, will check it out for my next AS3 project, thanks for pointing it out :)
     
  47. burost

    burost

    Joined:
    May 15, 2012
    Posts:
    5
    First off, thanks for putting in the effort to make HOTween. So far it seems very slick and easy to use.

    I'm having some issues with calling GoTo multiple times on a Sequence. The Sequence contains five tweeners all operating on the same value. Calling Play on it works fine, and the value adjusts as I expect.

    Calling GoTo will adjust the value properly to the first value I give, and ignores any subsequent GoTo calls.

    Is this expected behavior?

    PS: While debugging this I noticed that isEmpty is returning true in all cases. Looking at the code it seems it defaults to that value and is never updated.
     
  48. burost

    burost

    Joined:
    May 15, 2012
    Posts:
    5
    I've narrowed it down a bit more.

    I had the OverwriteManager turned on, which seems to be the culprit. I noticed the manager emitting warnings as I built the Sequence. Disabling the manager has the Sequence behaving as I expected.

    I remember the OverwriteManager was in a bit of a beta state. I would expect it to play nicely in this case, but it doesn't look like it distinguishes between a Tweener that was created in a paused state versus one that is actually running. Am I missing an alternate way to construct a dormant Tweener?
     
  49. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,239
    Mhmm you might have hit a bug. Could you post for me a UnityPackage or the code that gives you trouble - OverwriteManager included - so I can check it out (tomorrow morning, here it's night and I'm going to be now :p).
     
  50. burost

    burost

    Joined:
    May 15, 2012
    Posts:
    5
    Here is a test component illustrating the issue. Add it to an orthographic camera and it will tween the viewport size.

    Enabling the OverwriteManager causes the Sequence to stop updating after the first GoTo is called. Play functions as normal.

    Code (csharp):
    1. using UnityEngine;
    2. using System;
    3. using System.Collections;
    4.  
    5. using Holoville.HOTween;
    6. using Holoville.HOTween.Plugins;
    7.  
    8. public class SequenceTest : MonoBehaviour {
    9.  
    10.     public bool enableOverwriteManager = false;
    11.  
    12.     public bool playSequence = false;
    13.  
    14.     private Sequence testSequence;
    15.  
    16.     void Awake()
    17.     {
    18.         if( enableOverwriteManager )
    19.         {
    20.             HOTween.EnableOverwriteManager();
    21.         }
    22.     }
    23.  
    24.     // Use this for initialization
    25.     void Start ()
    26.     {
    27.         testSequence = new Sequence(new SequenceParms().Id("sequence") );
    28.  
    29.         Tweener segment1 = HOTween.To( Camera.main, 1.0f, new TweenParms().Prop("orthographicSize", 10).Ease(EaseType.Linear).Pause() );
    30.         testSequence.Append( segment1 );        
    31.  
    32.         Tweener segment2 = HOTween.To( Camera.main, 1.0f, new TweenParms().Prop("orthographicSize", 20).Ease(EaseType.Linear).Pause() );
    33.         testSequence.Append( segment2 );  
    34.  
    35.         Tweener segment3 = HOTween.To( Camera.main, 1.0f, new TweenParms().Prop("orthographicSize", 40).Ease(EaseType.Linear).Pause() );
    36.         testSequence.Append( segment3 );
    37.  
    38.         Tweener segment4 = HOTween.To( Camera.main, 1.0f, new TweenParms().Prop("orthographicSize", 10).Ease(EaseType.Linear).Pause() );
    39.         testSequence.Append( segment4 );
    40.  
    41.         if( playSequence )
    42.         {
    43.             testSequence.Play();
    44.         }
    45.     }
    46.    
    47.     // Update is called once per frame
    48.     void Update ()
    49.     {
    50.         if( playSequence )
    51.         {
    52.             return;
    53.         }
    54.  
    55.         float currentAlpha = testSequence.elapsed / testSequence.duration;
    56.  
    57.         if( currentAlpha < 1.0f )
    58.         {
    59.             float newAlpha = currentAlpha + ( 0.2f * Time.deltaTime );
    60.  
    61.             newAlpha = Math.Min( newAlpha, 1.0f );
    62.  
    63.             testSequence.GoTo( newAlpha * testSequence.duration );
    64.  
    65.             Debug.Log("SequenceTest: Alpha: " + newAlpha );
    66.         }
    67.     }
    68. }